HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   ISPConfig 3 Priority Support (http://www.howtoforge.com/forums/forumdisplay.php?f=35)
-   -   Nginx / protect directory and Wordpress (http://www.howtoforge.com/forums/showthread.php?t=62065)

cafeine65 3rd June 2013 14:43

Nginx / protect directory and Wordpress
 
Hi,

I have some problems with nginx and wordpress and protect directory

I have a wordpress site with permalink active :
Code:

www.mywebsite.com/index.php/%year%/%monthnum%/%day%/%postname%/
I have a nginx and in ISP Config web site I add :
Code:

try_files $uri $uri/ /index.php?q=$uri&$args;
It's work fine

When I add a protect folder on / (base of my web site), I have a 404 not found

here the code of the vhost
Code:

server {
        listen *:80;


        server_name mywebsite.com ;

        root  /var/www/mywebsite.com/web;



        index index.html index.htm index.php index.cgi index.pl index.xhtml;



        error_log /var/log/ispconfig/httpd/mywebsite.com/error.log;
        access_log /var/log/ispconfig/httpd/mywebsite.com/access.log combin$

        ## Disable .htaccess and other hidden files
        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/client1/web1/web/stats/.htpas$
        }

        location ^~ /awstats-icon {
            alias /usr/share/awstats/icon;
        }

        location ~ \.php$ {
            try_files /4e59b599d97e7f99c0a520473a78ad7.htm @php;
        }

        location @php {
            try_files $uri =404;
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9036;
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9036;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            #fastcgi_param PATH_INFO $fastcgi_script_name;
            fastcgi_intercept_errors on;
        }


        try_files $uri $uri/ /index.php?q=$uri&$args;

        location / {
                auth_basic "Members Only";
                auth_basic_user_file /var/www/clients/client1/web1/web/.htpassw$

                location ~ \.php$ {
                    try_files /4e59b599d97e7f99c0a520473a78ad7.htm @php;
                }
        }

}


Have you a fix or an idea ?

Thanks in advance

falko 3rd June 2013 16:19

Please try this configuration in the nginx Directives field instead:

Code:

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

# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

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


cafeine65 4th June 2013 16:49

thanks a lot. it's fine now. I put code on Directive Snippets for a future use.


All times are GMT +2. The time now is 03:34.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.