标签:根据 tool tools httpd asi blog 图片 img 域名
安装nginx:
https://www.cnblogs.com/liuzhijun666/p/13124033.html
[root@server ~]# cd /usr/local/nginx/conf/
[root@server conf]# vim nginx.conf
server {
listen 80; #端口号
server_name www.example.com; #设置访问域名
location / {
root html; #文件位置默认html
index index.html index.htm;
allow 192.168.7.10/32; #允许访问的Ip(这是本机Ip),或者网段
deny all; #deny禁止,all所有
}
}
#本机ip访问
[root@server conf]# echo 123 > ../html/index.html
[root@server conf]# systemctl restart nginx
[root@server conf]# curl www.example.com
123
[root@server conf]#
外面效果:
[root@server ~]# cd /usr/local/nginx/conf/
[root@server conf]# vim nginx.conf
server {
listen 80;
server_name www.example.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
auth_basic "欢迎信息";
auth_basic_user_file "/usr/local/nginx/conf/passwd"; //账户密码文件
}
}
[root@server conf]# systemctl restart nginx
[root@server conf]# yum install -y httpd-tools
[root@server conf]# htpasswd -c -m /usr/local/nginx/conf/passwd user
New password: 123
Re-type new password: 123
Adding password for user user
[root@server conf]# systemctl restart nginx
效果:
用户:user
密码:123
标签:根据 tool tools httpd asi blog 图片 img 域名
原文地址:https://www.cnblogs.com/liuzhijun666/p/13138177.html