Centos7安装nginx教程!超简单
生活随笔
收集整理的這篇文章主要介紹了
Centos7安装nginx教程!超简单
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.下載安裝nginx
yum install nginx2.安裝完成默認目錄在/etc/nginx
3.進入/etc/nginx/conf.d目錄創建一個tomcat_mynginx.conf文件,內容為:
server {
listen 80; server_name *.tyzou.com; location / { proxy_pass http://localhost:8888; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }}
備注:測試是否配置正確:nginx -t
4.修改tomcat/conf/server.xml文件的啟動端口
<Connector port="8888" protocol="HTTP/1.1"connectionTimeout="20000"redirectPort="8443" />5.啟動tomcat
./startup.sh6.啟動nginx
systemctl start nginx備注:如果要配置多個tomcat,就在conf.d目錄下多創建一個.conf文件吧!so easy!你學會了嗎?
總結
以上是生活随笔為你收集整理的Centos7安装nginx教程!超简单的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: VMware虚拟机克隆CentOS后网卡
- 下一篇: Missing binding node