热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

特别注意

1、其他目录下的。网页文件必须写成index.html不能写成sina.html,更不能写成test.index.html否则报错,这是格式2、配置域名

1、其他目录下的。网页文件 必须写成 index.html 不能写成 sina.html,更不能写成test.index.html 否则报错,这是格式2、配置域名必须要写到host里面;和通过百度访问域名是另一回事;通过 curl+ 域名访问只能对应80端口,不能写成8083其他端口 ,如下server {listen 80; 注意:写 8083其他端口,就不能通过curl +域名来访问。 想从百度里面访问域名必须注册备案域名server_name www.test1.com;access_log logs/baidu.access.log ;location / {root /web/test1;index index.html index.htm;}}3、没有注册域名最后不要用域名, 容易出错, 全都写成ip+端口 模式 , 例如下面[root@host-10-1-1-161 conf.d]# pwd
/etc/nginx/conf.d
[root@host
-10-1-1-161 conf.d]# cat test1.conf
server {
listen
8083;
server_name
127.0.0.1:8083;
location
/ {
root
/web/sing/;
index index.html index.htm;
}
}
4、重要:修改配置文件使用虚拟机,否则怎么配置都不生效,添加如下用户[root@host-10-1-1-161 html]# ll /etc/nginx/nginx.conf
-rw-r--r-- 1 root root 345 Aug 26 10:41 /etc/nginx/nginx.conf
[root@host
-10-1-1-161 html]# vi /etc/nginx/nginx.conf
user root root; #说明:这里的user根据 自己的nginx.conf文件所在的目录的属主属性而定
worker_processes
1;5、其他目录下的 html文件,必须写成 xxx.index.html 否则无法访问 必须要带index.html 否则无法访问[root@host-10-1-1-161 ~]# curl http://127.0.0.1:8080

<head>head>
"white">

403 Forbidden



nginx/1.12.2



[root&#64;host
-10-1-1-161 ~]# mv /web/sing/sina.html /web/sing/index.html
[root&#64;host
-10-1-1-161 ~]#
[root&#64;host
-10-1-1-161 ~]# curl http://127.0.0.1:8080


this is my nginx


6、8084端口不能用&#xff1b;端口不用冲突

 

转:https://www.cnblogs.com/effortsing/p/10012457.html



推荐阅读
author-avatar
pang1995_313
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有