1

I have php70 with nginx on vestacp. My admin panel work when url example.com/index.php?p=admin/dashboard, but not work example.com/admin/dashboard

My nginx conf:

server {
     listen      ip:80;
     server_name example.com www.example.com;
     root        /home/User/web/example.com/public_html;
     index       index.php index.html index.htm;
     access_log  /var/log/nginx/domains/example.com.log combined;
     access_log  /var/log/nginx/domains/example.com.bytes bytes;
     error_log   /var/log/nginx/domains/example.com.error.log error;

     location / {
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
        }

        location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9002;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
     }
}

location ~* "/\.(htaccess|htpasswd)$" {
    deny    all;
    return  404;
}

location /vstats/ {
    alias   /home/User/web/example.com/stats/;
    include /home/User/conf/web/example.com.auth*;
}

include     /etc/nginx/conf.d/phpmyadmin.inc*;
include     /etc/nginx/conf.d/phppgadmin.inc*;
include     /etc/nginx/conf.d/webmail.inc*;

include     /home/User/conf/web/nginx.example.com.conf*;

}

1

I added a few new lines to conf:

server {
    listen      ip:80;
    server_name example.com www.example.com;
    root        /home/User/web/example.com/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/example.com.log combined;
    access_log  /var/log/nginx/domains/example.com.bytes bytes;
    error_log   /var/log/nginx/domains/example.com.error.log error;

    location / {
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
        }

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

        location ~ [^/]\.php(/|$) {
            try_files $uri $uri/ /index.php?$query_string;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9002;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
       }
}

location ~* "/\.(htaccess|htpasswd)$" {
    deny    all;
    return  404;
}

location /vstats/ {
    alias   /home/User/web/example.com/stats/;
    include /home/User/conf/web/example.com.auth*;
}
0

Here's an Nginx config that might help you: Nginx-Craft

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.