zoukankan      html  css  js  c++  java
  • 腾讯云Ubunt安装nginx

    安装nginx

    • 登录腾讯云服务器

    • 输入安装命令

    	sudo apt-get install ngnix
    
    • 查看相关信息
      查看软件包所在的目录,及该软件包中的所有文件
    	sudo dpkg -L ngnix
    
    • 看软件包的版本信息:
    	sudo dpkg -l ngnix
    
    • 启动nginx
    	sudo /etc/init.d/nginx start
    
    • 测试ngnix服务是否正常运行
    	wget http://127.0.0.1
    

    配置nginx

    nginx默认配置文件在 /ect/nginx/nginx.confg路径下

    该配置文件使用include包含了/ect/nginx/sites-available,/ect/nginx/sites-enabled下的所有文件,以及/ect/nginx/confi.d文件下所有的.config文件

    配置同IP不同端口代理(server配置)

    /ect/nginx/sites-enabled 路径下新建文件multiServer文件,写入以下内容

    这里我们将域名hel.h-five.com代理到当前ip的8081端口

    将域名icloud.h-five.com代理到当前ip的8081端口

    	## 域名一
    	server_name hel.h-five.com;
    
            location / {
                    proxy_pass http://127.0.0.1:8081;
    
                    proxy_set_header Host $host;
                    proxy_set_header X-Real-IP  $remote_addr;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            }
    	}
    
    	## 域名二
    	server_name icloud.h-five.com;
    
            location / {
                    proxy_pass http://127.0.0.1:8082;
    
                    proxy_set_header Host $host;
                    proxy_set_header X-Real-IP  $remote_addr;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    
            }
    	}	
    
    
    重新载入配置文件即可访问
    	sudo /etc/init.d/nginx reload
    
  • 相关阅读:
    晶振及COMS电路
    笔记16 C# typeof() & GetType()
    笔记15 修饰符
    笔记14 数据库编程技术
    C#基础知识
    C#连接数据库
    笔记13 winform
    笔记12 export to excel (NPOI)
    笔记11 export to excel
    笔记10
  • 原文地址:https://www.cnblogs.com/hlere/p/6745384.html
Copyright © 2011-2022 走看看