0

I am new to nginx but I followed religiously all the tutorials and tried to setup my WordPress site but I have an issue at the moment I cannot resolve. Basically I have the following configuration in my config file for my wordpress site:

server {
    listen 80;
    listen 443 default ssl;

    server_name domain.com;
    root /var/www/html/domain.com/htdocs;

    access_log /var/www/html/domain.com/htdocs/logs/access.log;
    error_log /var/www/html/domain.com/htdocs/logs/error.log;

    location / {
            index index.php index.html;
            try_files $uri $uri/ /index.php?$args;
    }

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

    location ~ /\. {
            access_log off;
            log_not_found off;
            deny all;
    }

    rewrite /files/$ /index.php last;

    if ($uri !~ wp-content/plugins) {
            rewrite /files/(.+)$ /wp-includes/ms-files.php?file=$1 last;
    }

    location ~* ^/(favicon.ico|robots.txt)$ {
            access_log off;
            log_not_found off;
    }

    location ~ .php$ {
            try_files $uri =404;

            # Include the fastcgi_params defaults provided by nginx
            include        /etc/nginx/fastcgi_params;

            # SCRIPT_FILENAME is a required parameter for things to work properly,
            # but is missing in the default fastcgi_params. We define it here to
            # be sure that it exists.
            #fastcgi_param   SCRIPT_FILENAME         $document_root$fastcgi_script_name;
            fastcgi_param SCRIPT_FILENAME /var/www/html/domain.com/htdocs$fastcgi_script_name;

                            # Use the upstream for fastcgi / php5-fpm that we defined in nginx.conf
            fastcgi_pass   php;

            # And get to serving the file!
            fastcgi_index  index.php;
    }

}

When I type the IP Address/domain.com I have a bit of a delay and then I just get the text of the site. No errors and really its almost like the page is not rendered. Is that because php is not getting parsed properly? Otherwise any ideas as to what I am doing wrong?

Dimitris
  • 101

1 Answers1

1

It looks like you haven't configured nginx to process PHP. Check out this answer.

sмurf
  • 4,750
  • 1
  • 26
  • 30