# Nginx rewrite - 404 Not Found



## alptraum (8. Jan. 2013)

Ich habe ein vBulletin + vBSEO.

vBSEO rewrite Rules :


```
location /forum/ {
rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;

try_files $uri $uri/ /forum/vbseo.php?$args;
}

location ~ /forum/(.*\.php)$ {
rewrite ^/forum/(.*)$ /forum/vbseo.php last;
}
location /forum/vbseo/(includes|resources/html|resources/xml)/ {
	allow      127.0.0.1;
	deny      all;
}
```
Ich hinzufüge in  /etc/nginx/sites-enabled/100-exampledomainname.conf


```
server {
        listen 85.31.186.133:80;

        
        server_name muhakeme.net www.seite.net;

        root   /var/www/seite.net/web;
		
        if ($http_host = "seite.net") {
            rewrite ^ $scheme://www.seite.net$request_uri permanent;
        }
		
		
        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/seite.net/error.log;
        access_log /var/log/ispconfig/httpd/seite.net/access.log combined;

        ## Disable .htaccess and other hidden files

location /forum/ {
rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;

try_files $uri $uri/ /forum/vbseo.php?$args;
}

location ~ /forum/(.*\.php)$ {
rewrite ^/forum/(.*)$ /forum/vbseo.php last;
}
location /forum/vbseo/(includes|resources/html|resources/xml)/ {
	allow      127.0.0.1;
	deny      all;
}

        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/client3/web3/.htpasswd_stats;
        }

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

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

        	
}
```
Dann 


```
/etc/init.d/nginx reload
```
Dann hat mein webseite überall 404 Fehler.

Wenn ich dann /etc/nginx/sites-enabled/100-exampledomainname.conf ganz default speichere ohne rewrite code, bekomme ich weiter 404 fehler.

Wo mache ich fehler? Wie kann ich lösen? Wie muss ich anders mein rewrite rules aktivieren ?


----------



## alptraum (8. Jan. 2013)

In ISPConfig panel habe ich mein DNS geöffnet und 7200 ---> 7201 eingestellt. In Kunde wieder aktualiesert und in webseite wieder aktualisiert. Mein webseite funktioniert jetzt ohne rewrite Rules einwandfrei aber wie kann ich mein rewrite rules benutzen?


----------

