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;
}
}
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有