PHP Question

Error on Installing Wordpress on Nginx

I'm trying to install a wordpress site in a Linux VPS with LEMP Setup. So far I've done setting up the wordpress files and setting ownership for nginx user/group on the WP directory/files, but when I go to the address to access the installation page for WP (https://domain.tld/wp-admin/install.php), I end up with a php file download instead.

Here's my virtual host configuration for the WP site:

server {
listen 80;
server_name domain.tld;
return 301 https://$server_name$request_uri;

server {
listen 443 ssl;

ssl on;
ssl_certificate /directory/to/crt;
ssl_certificate_key /directory/to/key;

server_name domain.tld;
root /var/www/html/domain.tld;
index index.php index.html index.htm;

location / {
try_files $uri $uri/ /index.php?q=$uri&$args;

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

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:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;

EDIT: I tried it in Firefox, and it's acting differently than in Chrome. The install.php page instead ends up in an error page like this:

An error occurred.

Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the > error log for details.

Faithfully yours, nginx.

Answer Source

I got it working now. The error was on the virtual host's *.conf file. I got the directory for php-fpm sock wrong. So that was the reason the php is not working on the site, and instead just downloads the install.php file, and domain is ending up in error.

fastcgi_pass unix:/var/run/php5-fpm.sock; <---- I just got the directory wrong on this one.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download