hellopasswd
nginx域名重定向
server_name后面支持写入多个域名。 这里与httpd进行比较
permanent是永久重定向,状态写为301,写为redirect则为302
1服务器
2 {
3 listen 80
4 server _ name test.com test1.com test2.com;
5 index index.htmlindex.htm index.PHP;
6 root /data/wwwroot/test.com;
7if($host!='test.com ' ) {
8rewrite^/(.* ) $ http://test.com/$1 permanent;
9 }
10
11location ().* )管理员. PHP $
12 {
13 auth_basic 'Auth ';
14 auth _ basic _ user _ file/usr/local/nginx/conf/htpasswd;
15 }
16 }
nginx 3360 theconfigurationfile/usr/local/nginx/conf/nginx.confsyntaxisok
nginx :配置文件/usr/local/nginx/conf/nginx.conftestissuccessful
Date: Fri,02 Mar 2018 08:10:08聆听夕阳/p Connection: keep-alive
location :http://test.com/index.html
Date: Fri,02 Mar 2018 08:11:27聆听的夕阳/p Last-Modified: Sat,03 Feb 2018 02:28:08聆听的夕阳/pconnection3360keep-
ETag: '5a751e38-6 '
accept-ranges :字节
Date: Fri,02 Mar 2018 08:11:31聆听夕阳/p Connection: keep-alive