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

}

}

相关推荐
Techblog of HaoWANG3 分钟前
Ubuntu 下将 Ollama 服务配置为监听 0.0.0.0:11434 完整实践
linux·数据库·ubuntu·ollama
小HANN9 分钟前
Ceph分布式存储深度解析-下篇
linux·运维·服务器·经验分享
张文君24 分钟前
ubuntu iscsi客户端 关闭磁盘
linux·运维·ubuntu
道尔柯南1 小时前
Linux 网络编程:从零掌握 TCP Socket 编程(附 C++ 实战)
linux·网络·tcp/ip
0+1111 小时前
Linux --ARP的具体过程与ARP欺骗
linux·服务器·网络
阿星_2 小时前
Linux Ubuntu 查看 SQLite 工具
linux·ubuntu·sqlite
疯狂成瘾者2 小时前
海康威视 WSS 视频取流原理:6014/559 端口、Nginx 代理与 TLS 证书问题
运维·nginx·音视频
Lsetea2 小时前
OpenSSL的checkhost显示不匹配却退出0:名称检查与证书验收
linux·https·shell·ssl证书·openssl
张文君2 小时前
Ubuntu iSCSI CHAP认证与Win11挂载
linux·运维·ubuntu
一直C2 小时前
嵌入式 Linux 驱动开发学习笔记:中断、等待队列与工作队列
linux·驱动开发·嵌入式硬件·学习·imx6ull