部署Nginx,配置文件

重启nginx

复制代码
cd /data/server/nginx/sbin
./nginx -s reload

#user  nobody;
worker_processes  1;  #nginx进程数,建议按照cpu数目来指定,一般为它的倍数。
worker_rlimit_nofile 65535;
events {
    worker_connections  1024;  #单个后台worker process进程的最大并发链接数  
}


http {
    include       mime.types;   #设定mime类型,类型由mime.type文件定义  
    default_type  application/octet-stream;

    #sendfile 指令指定 nginx 是否调用 sendfile 函数(zero copy 方式)来输出文件,
    #对于普通应用,必须设为 on,
    #如果用来进行下载等应用磁盘IO重负载应用,可设置为 off,
    #以平衡磁盘与网络I/O处理速度,降低系统的uptime
    sendfile  on;
    keepalive_timeout  65;  #用于设置客户端连接保持活动的超时时间,在超过这个时间之后服务器会关闭该链接。
    
 server {
        listen       80;
        server_name  localhost;

        location / {
            root   /data/front/equip-h5;
            index index.html index.htm;
        }
        
	location /prod-api/ {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://121.196.227.25:8083;
        rewrite "^/prod-api/(.*)$" /$1 break;
    }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }


}
server {
    listen       8081;
    server_name  121.196.227.25;

    location / {
        root   /data/front/dist;
        try_files $uri $uri/ /index.html;
        index index.html index.htm;
    }


    location /prod-api/ {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header REMOTE-HOST $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://121.196.227.25:8082;
	rewrite "^/prod-api/(.*)$" /$1 break;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

}


server{
	listen       8082;
        server_name  121.196.227.25;

        location / {
            root   /data/project/equip-manage/backend/web;
            index index.php index.html index.htm;

	    if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php/$1 last;
                break;
            }

	}

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

       location ~ \.php {
            root  /data/project/equip-manage/backend/web;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
	
    }

server{
        listen       8083;
        server_name  121.196.227.25;

        location / {
            root   /data/project/equip-manage/frontend/web;
            index index.php index.html index.htm;

            if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php/$1 last;
                break;
            }

        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

       location ~ \.php {
            root  /data/project/equip-manage/frontend/web;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

    }


}
相关推荐
杜子不疼.1 分钟前
内网监控工具翻身!Uptime Kuma+cpolar 实现远程运维自由
linux·运维·服务器
拾光Ծ5 分钟前
【Linux】Ext系列文件系统(一):初识文件系统
linux·运维·服务器·硬件架构·ext文件系统
天荒地老笑话么7 分钟前
Vim核心快捷键与运维实战指南
运维·vim·excel
IT199513 分钟前
Linux笔记-使用systemd管理进程
linux·运维·笔记
Web极客码13 分钟前
WordPress 在哪里存储网站上的图片?
运维·服务器·wordpress
杜子不疼.19 分钟前
用Claude Code构建AI内容创作工作流:从灵感到发布的自动化实践
运维·人工智能·自动化
草莓熊Lotso20 分钟前
从零手搓实现 Linux 简易 Shell:内建命令 + 环境变量 + 程序替换全解析
linux·运维·服务器·数据库·c++·人工智能
人工智能训练8 小时前
【极速部署】Ubuntu24.04+CUDA13.0 玩转 VLLM 0.15.0:预编译 Wheel 包 GPU 版安装全攻略
运维·前端·人工智能·python·ai编程·cuda·vllm
微露清风9 小时前
系统性学习Linux-第二讲-基础开发工具
linux·运维·学习
阳光九叶草LXGZXJ10 小时前
达梦数据库-学习-48-DmDrs控制台命令(同步之Manager、CPT模块)
linux·运维·数据库·sql·学习