# cat /etc/nginx/sites-available/default
# Default server configuration
#
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.php index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~ ^/~(?<user>.+?)(?<path>/.*)?$ {
                alias /home/$user/public_html$path;
                autoindex on;

                location ~ \.php$ {
                        if (!-f $request_filename) { return 404; }

                        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                        fastcgi_intercept_errors on;
                        include fastcgi_params;
                        fastcgi_param  SCRIPT_FILENAME $request_filename;
                }
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                # With php7.0-cgi alone:
                # fastcgi_pass 127.0.0.1:9000;
                # With php7.0-fpm:
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }



        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny all;
        }


+ Recent posts