HostOnNet Blog

nginx wordpress

Here is nginx config for wordpress on Ubuntu 16.04

server {
        listen 443;
        server_name www.blog.hostonnet.com blog.hostonnet.com;
        root /home/blog.hostonnet.com/public_html;
        index index.php;

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

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

        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }

        ssl on;
        ssl_certificate /etc/ssl/blog.hostonnet.com.crt;
        ssl_certificate_key /etc/ssl/blog.hostonnet.com.key;

}

server {
    listen 80;
    server_name  www.blog.hostonnet.com blog.hostonnet.com;
    return       301 https://blog.hostonnet.com$request_uri;
}

nginx


Posted in Nginx