根据http://wiki.nginx.org/HttpCoreModule 我试图让服务器搜索特定目录中的文件。即:http ://exemple.com/sitemap.xml会查看 rootFolder/sitemaps/specificname-sitemap.xml
我添加了这个:
location /sitemap.xml {
alias /sitemaps/specificname-sitemap.xml;
}
但它不起作用。我错过了什么?
编辑:我的完整配置是:
server {
listen 80; ## listen for ipv4; this line is default and implied
root /var/www/exemple/public;
index index.html index.htm index.php;
server_name exemple.com;
location /sitemap.xml {
alias /sitemaps/cs-sitemap.xml;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}