nginx - problem with change location root folder

Discussion in 'Installation/Configuration' started by stefek143, Jul 22, 2014.

  1. stefek143

    stefek143 New Member

    Hi ,

    I've created the new website with use ispconfig and path to this is /var/www/myweb.com/web/ . All is ok but main folder to this website I must set up like /var/www/myweb.com/web/mainpage . so then I've added in Options to field "nginx Directives" such code:
    Code:
     location / {
     root /var/www/myweb.com/web/mainpage; 
     }
    And here is problem. if I type in browser myweb.com then works only if in folder /mainpage is index.html but doesn't if index.php. If I delete index.html and will be only index.php then I have error 404 not found.

    My vhost config:

    Code:
    server {
            listen *:80;
    
    
            server_name myweb.com www.myweb.com;
    
    
    
    
            index index.html index.htm index.php index.cgi index.pl index.xhtml;
    
    
    
            error_page 400 /error/400.html;
            error_page 401 /error/401.html;
            error_page 403 /error/403.html;
            error_page 404 /error/404.html;
            error_page 405 /error/405.html;
            error_page 500 /error/500.html;
            error_page 502 /error/502.html;
            error_page 503 /error/503.html;
            #recursive_error_pages on;
            location = /error/400.html {
    
                internal;
            }
            location = /error/401.html {
    
                internal;
            }
            location = /error/403.html {
    
                internal;
            }
            location = /error/404.html {
    
                internal;
            }
            location = /error/405.html {
    
                internal;
            }
            location = /error/500.html {
    
                internal;
            }
            location = /error/502.html {
    
                internal;
            }
            location = /error/503.html {
    
                internal;
            }
    
            error_log /var/log/ispconfig/httpd/myweb.com/error.log;
            access_log /var/log/ispconfig/httpd/myweb.com/access.log combined;
    
            location ~ /\. {
                deny all;
                access_log off;
                log_not_found off;
            }
    
            location = /favicon.ico {
                log_not_found off;
                access_log off;
            }
    
            location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
            }
    
            location /stats/ {
    
                index index.html index.php;
                auth_basic "Members Only";
                auth_basic_user_file /var/www/clients/client0/web15/web/stats/.htpasswd_stats;
            }
    
            location ^~ /awstats-icon {
                alias /usr/share/awstats/icon;
            }
    
            location ~ \.php$ {
                try_files /7194346190f40f4d88f625a2623a6600.htm @php;
            }
    
            location @php {
                try_files $uri =404;
                include /etc/nginx/fastcgi_params;
                fastcgi_pass unix:/var/lib/php5-fpm/web15.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_intercept_errors on;
            }
    location / {
    root   /var/www/myweb.com/web/mainpage;
    }
    
    
    }
     

Share This Page