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";

}

}

相关推荐
PHP实战开发录11 分钟前
PHP文件上传成功为什么页面却找不到
开发语言·nginx·php·开发
FlightYe18 分钟前
音视频修炼之基础理论(五):AAC格式与解析
android·linux·c++·音视频·aac
米糕闯编程1 小时前
鱼香ros2(一)在ubuntu中安装ros2
linux·运维·ubuntu·机器学习
Huangjin007_1 小时前
【Linux 系统篇(十八)】进程(六) :环境变量
linux·运维·服务器
ShineWinsu1 小时前
对于MySQL:数据库的操作的解析
linux·数据库·c++·mysql·面试·笔试·库的操作
cnnews1 小时前
Ubuntu 编译 postmarketOS
linux·运维·arm开发·ubuntu·github·音视频
w01_02_031 小时前
linux, 桌面, 自启动。
linux·运维·服务器
从零开始的嵌入式之旅2 小时前
day36
linux·c语言·经验分享·笔记·嵌入式硬件
吴声子夜歌2 小时前
Linux命令——查找文件
linux·运维·学习
mounter6252 小时前
Linux 内核 binfmt_misc 深度全景解析:历史、架构、安全
linux·安全·linux kernel·kernel