nginx配置项目,配置文件及相应linux命令

云服务器安装nginx步骤

安装nginx:

yum install nginx

启动nginx:

nginx

停止nginx:

nginx -s stop

配置文件路径/etc/nginx/conf.d/

上传配置文件到这个目录下,然后重启nginx


配置文件(单云服务器配置单项目)

xxx.conf

server {

listen 8007;

server_name localhost;

location / {

root /opt/commeta-mng/;

index /index.html;

try_files uri uri/ /index.html;

}

#图片放置云服务器位置

location /pictures {

alias /data/pictures/;

}

location ^~ /commeta-upms {

proxy_pass http://ip:8000;

}

location ^~ /commeta-logic {

proxy_pass http://ip:8000;

}

location ^~ /commeta-im {

proxy_pass http://ip:8000;

}

location /commeta-socket/ {

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Host $host;

proxy_pass http://ip:8004;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection "upgrade";

}

}

配置文件(服务高可用的多云服务器配置2个项目)

高可用xxx.conf

upstream commeta-socket {

least_conn ; #使用最小连接

server 10.8.55.15:8000 ;

server 10.8.55.16:8000 ;

}

server {

listen 8007;

server_name localhost;

location /partybuilding/ {

alias /opt/partybuilding-ui/;

index index.html;

try_files uri uri/ /partybuilding/index.html;

}

location /commeta-mng/ {

alias /opt/commeta-mng-ui/;

index index.html;

try_files uri uri/ /commeta-mng/index.html;

}

location ^~ /commeta-upms {

proxy_pass http://commeta-socket;

}

location ^~ /commeta-logic {

proxy_pass http://commeta-socket;

}

location ^~ /commeta-im {

proxy_pass http://commeta-socket;

}

location /commeta-socket/ {

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Host $host;

proxy_pass http://commeta-socket;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection "upgrade";

}

}

相关推荐
笔记本note1 小时前
Linux 文件系统与设备文件
linux·服务器·文件系统
无足鸟ICT1 小时前
【RHCA+】_proc_pid_cmdline
linux·运维·服务器
学以智用2 小时前
CentOS Linux 文件操作详解
linux
饿了吃洗衣凝珠3 小时前
shell循环
linux·运维·服务器
代码不停4 小时前
Linux基础知识
java·linux·数据库
东风微鸣5 小时前
Linux台式机也能指纹识别登录验证啦
linux·指纹
路溪非溪7 小时前
USB的基础知识总结
linux
女神下凡7 小时前
芯易选(143):晶视智能(CVITEK)_开发指南
linux·arm开发·stm32·单片机·嵌入式硬件
Hhy_11078 小时前
【Linux 进击之路 · 01】起航篇:从认识操作系统到XShell 远程连接、多叉树目录体系到高频基础指令全解析
linux·服务器·后端·学习
-梅10 小时前
linux网络(1)网络聊天室与网络计算器
linux·运维·服务器