If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.


重新载入配置

service nginx reload


此时在浏览器中输入`192.168.87.131:8099` 就能访问到我们的页面了(如果开启了防火墙的话需要提前设置允许访问该端口)。

![](https://i.maqian.xin/2017/09/QQ截图20170924174653.png)

## 三、日志

当前配置设置了两个日志信息,一个是访问日志,一个是错误日志。

访问日志信息中保存了所有的访问信息,包括`ip` `User-Agent` 等等,都被记录了下来:

[root@localhost nginx]# vi logs/demo.access.log
192.168.87.1 - - [25/Sep/2017:01:43:51 +0800] "GET / HTTP/1.1" 200 606 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36" "-"
192.168.87.1 - - [25/Sep/2017:01:43:51 +0800] "GET /favicon.ico HTTP/1.1" 404 571 "http://192.168.87.131:8099/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36" "-"


错误日志日志中保存了访问过程中出现的错误,这里面有一条错误信息是说`favicon.ico` 文件未找到:

[root@localhost nginx]# vi logs/demo.error.log
2017/09/25 01:43:51 [error] 13504#0: *104 open() "/data/www/favicon.ico" failed (2: No such file or directory), client: 192.168.87.1, server: 192.168.87.131, request: "GET /favicon.ico HTTP/1.1", host: "192.168.87.131:8099", referrer: "http://192.168.87.131:8099/"

最后修改:2018 年 12 月 16 日
如果觉得我的文章对你有用,请随意赞赏