yum install -y httpd-tools
htpasswd -c /etc/nginx/conf.d/test test
cat test
server {
listen 80;
server_name bicycle.umdzz.cn;
location ^~ /File/ {
root /usr/share/nginx/html/easyswoole_bicycle/Static;
auth_basic "Please Input Password..."; #提示信息
auth_basic_user_file /etc/nginx/conf.d/test; #用户密码文件存放路径
}
location / {
root /usr/share/nginx/html/easyswoole_bicycle/Static/Admin/;
index index.html index.htm;
proxy_http_version 1.1;
proxy_set_header Connection "keep-alive";
proxy_set_header X-Real-IP $remote_addr;
if (!-f $request_filename) {
proxy_pass http://127.0.0.1:9505;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ /\.ht {
deny all;
}
}
systemctl restart nginx
server {
listen 80;
server_name bicycle.umdzz.cn;
#提示信息
auth_basic "Please Input Password...";
#用户密码文件存放路径
auth_basic_user_file /etc/nginx/conf.d/test;
location / {
root /usr/share/nginx/html/easyswoole_bicycle/App;
#列表
autoindex on;
#隐藏真实大小,以M或G显示
autoindex_exact_size on;
#显示时间
autoindex_localtime on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ /\.ht {
deny all;
}
}
本文为北溟有鱼QAQ原创文章,转载无需和我联系,但请注明来自北溟有鱼QAQ https://www.amdzz.cn
最新评论