默认虚拟主机可以泛解析 虚拟主机最好使用域名命名 禁掉在default_server.conf中添加一行 "deny all;",出现403错误
(在hosts里只能本地访问,要想外网能访问,你需要配置DNS,这里暂时不需要)
- #cd /etc/nginx/conf.d
- #cp default.conf blog.leon.cc.conf
- #vi blog.leon.cc.conf
- #mkdir -p /data/wwwroot/blog.leon.cc
- #cd /data/wwwroot/blog.leon.cc
- #wget https://wordpress.org/latest.tar.gz
- #tar zxvf
- #mv wordpress/* ./
- #rm -rf wordpress latest.tar.gz
问题分析:其他虚拟主机都正常,就是blog.leon.cc不正常 blog.leon.cc域名可以ping通,但是nginx访问403
原来是data目录下不行。。。应该是权限问题
- nginx -t;//检查配置文件nginx.conf是否正确
- nginx -s reload;//重载配置
- nginx -c /etc/nginx/nginx.conf;//启动nginx
- ps -ef|grep nginx;//查看nginx进程
- service nginx start;//启动nginx
- service nginx stop;//关闭nginx