surrealroad / wp-safari-push

Safari Push Plugin for Wordpress
MIT License
18 stars 5 forks source link

How to properly set up the plugin #11

Open monecchi opened 10 years ago

monecchi commented 10 years ago

Hello. This is not and issue, but rather a request for detailed instructions on how to properly set up the plugin.

Although I've read all the plugin's documentation as also further instructions on https://github.com/surrealroad/Safari-Push-Notifications, I still can't get the plugin to work as intended. I run a seld-managed vps and I use a SSL (HTTPS) server, signed by a recognised authority (Comodo).

I'd really appreciate any help from the experts. P.S: As I'm not a developer I apologize for any noob terms I might be using here...Thanks in advance for your attention.

What I've done until now:

Finally I created the folders /v1/push/ under my WordPress website root directory on my server and moved all the following files to the /push/ directory. 1 - config.php 2 - createPushPackage.php 3 - index.php 3 - desktop.php 4 - mysqli.inc.php 5 - And the /pushPackage.raw/ folder

My server's directory structure for my WordPress installation is a bit different as follows: I have the WordPress installed under a directory named /site/ which lies on my website's root directory that is /www/, meaning my WP website runs on /www/site/ - This is an ordinary nginx server and I have no issues regarding the ssl certificate from Comodo or the WP website itself.

I confess I'm totally lost here, so after moving the aforementioned files to the server I placed the certificates mysite_webpush.p12 and apns-cert.pem right within the /v1/ directory while the rest of the files I uploaded to the /push/ directory.

Here's a example of the organization I've done.

/www/site/v1/ ---> Here I placed the certificates _mysitewebpush.p12 and apns-cert.pem /www/site/v1/push/ ---> Here I placed all the files config.php, createPushPackage.php, index.php, desktop.php, mysqli.inc.php and the /pushPackage.raw/ folder.

The config.php set up

I've set up the config.php as follows:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for storing device ids */
define('DB_NAME', 'mydb_name');

/** MySQL database username */
define('DB_USER', 'mydb_user');

/** MySQL database password */
define('DB_PASSWORD', 'mydb_password');

/** MySQL hostname */
define('DB_HOST', 'localhost');

// ** Push server site settings ** //
/* Web Service Base URL */
define('WEBSERVICE_URL', 'https://pizzariameurancho.com.br/site/');

/* Website Push ID unique identifier */
define('WEBSITE_UID', 'web.com.br.pizzariameurancho_myapp');

/* Website Name */
define('WEBSITE_NAME', 'Pizzaria Meu Rancho');

/* Allowed Domains, must be comma-seperated and quoted */
define('ALLOWED_DOMAINS', '"https://pizzariameurancho.com.br",     "https://www.pizzariameurancho.com.br"');

/* URL string format for links */
define('URL_FORMAT', 'https://pizzariameurancho.com.br/site/');

// ** Certificate settings - certificates provided by Apple ** //
define('CERTIFICATE_PATH', './mysite_webpush.p12');     // Change this to the path where your     certificate is located
define('CERTIFICATE_PASSWORD', ''); // Change this to the certificate's import password
define('PRODUCTION_CERTIFICATE_PATH', './apns-cert.pem'); // Change this to the path to your Website Push ID Production Certificate

// ** Authorisation code for requesting push notifications to be sent ** //
define('AUTHORISATION_CODE', '');

// ** APNS Settings, probably don't need to be changed ** //
define('APNS_HOST', 'gateway.push.apple.com');
define('APNS_PORT', 2195);

Could anyone please point out what I'm missing. This has been a total puzzle to me. Thanks a lot for your attention.

Regards,

Adriano.

surrealroad commented 10 years ago

Ok a few things you need to look at:

monecchi commented 10 years ago

Hello. Thanks for your tips and explanation. I'll set up a subdomain on my server and create a new nginx server block (such as an apache virtual host) for this purpose only.

Regarding the .htaccess configuration part, where is it handled? Do you mean the true .htaccess file which lies on the root directory of most apache servers or the htaccess configuration is manipulated on one of the php files? I'm afraid things are handle differently on nginx, but I'll ask for help on stackoverflow's serverfault/wp dev sites and make a research by myself too.

That's a good hint about the authorization code, I had a huge doubt about it the first time I adjusted the plugin settings.

So do you mean I should put 'urlargs' inside of this line such as follows? define('WEBSERVICE_URL', 'urlargs');

For now I say thanks a lot for your help. I'll update here if I succeed.

Regards,

Adriano.

surrealroad commented 10 years ago

The .htaccess file is included in the reference push service: https://github.com/surrealroad/Safari-Push-Notifications/blob/master/.htaccess it just lives in the root folder (you shouldn't need to edit it if you're using Apache)

Put urlargs in the WordPress plugin settings page, in the field "Web Service Push URL Arguments Tag" (you wrote on the image that this field was left empty).

You should probably have define('WEBSERVICE_URL', 'https://pizzariameurancho.com.br/site/'); in the config file