Welcome! Log In Create A New Profile

Advanced

Re: nginx's bug(alias and $request_uri to conflict)

October 11, 2010 01:10AM
On Mon, Oct 11, 2010 at 10:46:28AM +0800, Simon Liu wrote:

> thanks!
>
> my nginx version is 0.8.52, index.html in /home/my_name/tools/nginx/html/
> , this is my nginx config:
>
> worker_processes 1;
>
> error_log logs/error.log debug;
> events {
> worker_connections 1024;
> }
> http {
> include mime.types;
> default_type application/octet-stream;
> expires 1y;
> sendfile on;
> server {
> listen 8080;
> server_name localhost;
> location ~* ^/html/(.+\.html)$ {
> alias /home/my_name/tools/nginx/html/$1;
> if ($request_uri ~ \.(html|htm|shtml)$) {
> expires 1h;
> }
> }
> error_page 500 502 503 504 /50x.html;
> location = /50x.html {
> root html;
> }
> }
> }

1) wiki.nginx.org/IfIsEvil

2) location ~* ^/html/(.+\.html)$ {
alias /home/my_name/tools/nginx/html/$1;

it's better to change to just

location ~* ^/html/.+\.html$ {
root /home/my_name/tools/nginx;

3) ...|shtml)$ is not matched by \.html)$

4) regex is usele here, so

location /html/ {
root /home/my_name/tools/nginx;
expires 1h;
}


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx's bug(alias and $request_uri to conflict)

Simon Liu October 10, 2010 10:50PM

Re: nginx's bug(alias and $request_uri to conflict)

Igor Sysoev October 11, 2010 01:10AM

Re: nginx's bug(alias and $request_uri to conflict)

Simon Liu October 11, 2010 02:00AM

Re: nginx's bug(alias and $request_uri to conflict)

Maxim Dounin October 11, 2010 03:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 136
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready