Ubuntu14.04下的nginx配置(配置文件nginx.conf):
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
1、上述配置中第一个location中的root指定与nginx同目录下的html目录,index指定默认的欢迎页面为index.html或index.htm。2、error_page指定发生错误500 502 503 504后,转向的页面。50.html页面同样在html目录下。
3、第二个location形式为location = /50x.html,表示精准的匹配。
4、与server同级的可以有多个。
本文详细介绍了Ubuntu14.04系统中nginx的配置方法,包括监听端口、域名设置、默认页面指定及错误页面重定向等内容。通过具体配置实例,帮助读者理解如何正确配置nginx。
1833

被折叠的 条评论
为什么被折叠?



