Skip to content

FAQ: Installation: Nginx Web Server

Frederick Townes edited this page Dec 18, 2018 · 2 revisions

Installation

Install nginx using software package utility of your operating system.

Centos/RHEL:

# yum -y install nginx

Ubuntu/Debian:

# apt-get -y install nginx

Configuration

Configuration samples can be found at ini directory of the plugin. The most important thing is to include nginx.conf file generated by W3 Total Cache. It will be located at root directory of your wordpress installation.

Example:

server {
    listen       80;
    server_name  yoursite.com;
    access_log  /var/log/nginx/yoursite.com_access.log;
    error_log  /var/log/nginx/yoursite.com_error.log debug;

    root   /var/www/vhosts/yoursite.com;
    index  index.php;

    include /var/www/vhosts/yoursite.com/nginx.conf;

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

    location ~ .php$ {
        fastcgi_index index.php;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Important Note

Do not forget to restart nginx service upon request from W3 Total Cache plugin when changing it's settings:

# service nginx restart