I’ve been scouring through all the nginx, Wordpress, PHP threads but I can’t seem to get what I need. I have a Ghost blog installed (working fine) and am trying to add a Wordpress along side it. The Wordpress block looks like:
server {
listen 80;
listen [::]:80;
root /var/www/html;
index index.php index.html index.htm;
server_name wpdomain.com;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
}
I’ve tried the alternative:
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
with the appropriate listen adjustment to no avail.
The status looks fine:
php7.2-fpm.service - The PHP 7.2 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.2-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-02-22 00:22:56 UTC; 6min ago
Docs: man:php-fpm7.2(8)
Main PID: 22063 (php-fpm7.2)
Status: "Processes active: 0, idle: 2, Requests: 6, slow: 0, Traffic: 0req/sec"
Tasks: 3
Memory: 11.4M
CPU: 68ms
CGroup: /system.slice/php7.2-fpm.service
├─22063 php-fpm: master process (/etc/php/7.2/fpm/php-fpm.conf)
├─22066 php-fpm: pool www
└─22067 php-fpm: pool www
and I can access the non-php files just fine, but I can’t setup Wordpress until I can actually access the PHP. I’m not seeing errors in /var/log/nginx/error.log either, I’m not sure what else to check at this point…
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
server {
listen 80;
# listen [::]:80; ## only need this directive if you are using ipv6
root /var/www/html;
index index.php index.html index.htm;
server_name wpdomain.com;
location / {
try_files $uri $uri/ /index.html /index.php$args; #removed unneeded args
}
# remove these for now until WP is up and running
# error_page 404 /404.html;
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root /usr/share/nginx/html;
#}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
ensure the WP directory has the right permissions:
find /var/www/html -type d -exec chmod 755 {} \;
find /var/www/html -type f -exec chmod 644 {} \;
You may want to look into a configuration similar to this : https://www.digitalocean.com/community/tutorials/how-to-host-multiple-websites-securely-with-nginx-and-php-fpm-on-ubuntu-14-04
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.