Question

Cant acess my index.php with nginx, please help

This is what my config file looks like atm.

server {
    listen 80;
    listen [::]:80;
    root /var/www/html/vanilla;
    index  index.php index.html index.html;
    server_name  pvpsmash.net www.pvpsmash.net;

    client_max_body_size 100M;

    autoindex off;

    location ~* /community/\.git { deny all; return 403; }
    location /community/build/ { deny all; return 403; }
    location /community/cache/ { deny all; return 403; }
    location /community/cgi-bin/ { deny all; return 403; }
    location /community/uploads/import/ { deny all; return 403; }
    location /community/conf/ { deny all; return 403; }
    location /community/tests/ { deny all; return 403; }
    location /community/vendor/ { deny all; return 403; }

    location /forum {try_files $uri $uri/ @forum;}
    location /community {
        try_files $uri @vanilla;
    }

    location @vanilla {
         rewrite ^/community(/.*) /community/index.php?p=$1&$args last;
    }
    location / {
        try_files $uri @vanilla;
         }

    location @vanilla {
        rewrite ^ /index.php$uri last;
        }

    location ~* "^/index\.php(/|$)" {
         include snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
     }

    location ~* "\.php(/|$)" {
        rewrite ^ /index.php$uri last;
         }
}

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.