Nginx —— 用HTTP核心模块配置一个静态的Web服务器
生活随笔
收集整理的这篇文章主要介绍了
Nginx —— 用HTTP核心模块配置一个静态的Web服务器
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
静态Web服务器的主要功能有NGX_HTTP_CORE_MODULE模块(HTTP框架的主哟奥成员)实现,当然,一个完整的静态Web服务器还有许多功能由其他的HTTP模块实现。
1》Web服务器的地址: 192.168.1.210
2》Web服务器端设置nginx的conf文件内容:
3》启动nginx服务器(找到nginx的二进制文件):
[root@localhost conf]# /usr/local/nginx/sbin/nginx查找方式:# whereis nginx (会显示 nginx的安装路径)
4》查看是否启动成功:
[root@localhost conf]# ps -aux | grep nginx root 34848 0.0 0.0 20748 1404 ? Ss 19:46 0:00 nginx: master process /usr/local/nginx/sbin/nginx nobody 35739 0.0 0.0 23284 1768 ? S 20:52 0:00 nginx: worker process root 35749 0.0 0.0 112720 984 pts/1 S+ 20:54 0:00 grep --color=auto nginx5》客户端测试地址: 192.168.1.93
打浏览器地址栏输入: http://192.168.1.210:8080/
注意: 这里一定要加conf文件中监听的端口,否则http默认监听80端口。
6》显示的页面内容:
[root@localhost sbin]# cat ../html/index.html <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style>body {width: 35em;margin: 0 auto;font-family: Tahoma, Verdana, Arial, sans-serif;} </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p><p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p><p><em>Thank you for using nginx.</em></p> </body> </html>
注意: Nginx —— nginx服务的基本配置(nginx.conf文件的详解)
总结
以上是生活随笔为你收集整理的Nginx —— 用HTTP核心模块配置一个静态的Web服务器的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: Linux命令 —— 输出一组系统信息
- 下一篇: Nginx —— 用HTTP proxy