部署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;
        }

    }


}
相关推荐
一匹电信狗13 小时前
【MySQL】数据库的相关操作
linux·运维·服务器·数据库·mysql·ubuntu·小程序
迦蓝叶13 小时前
JAiRouter v1.0.0 正式发布:企业级 AI 服务网关的开源解决方案
java·运维·人工智能·网关·spring·ai·开源
bugtraq202113 小时前
为什么.NET的System.IO.Compression无法解压zlib流
linux·运维·服务器
insight^tkk14 小时前
【Docker】记录一次使用docker部署dify网段冲突的问题
运维·人工智能·docker·ai·容器
K_i13414 小时前
Hadoop 集群自动化运维实战
运维·hadoop·自动化
Siren_dream15 小时前
在VMware上运行Linux(我选择的是Ubuntu)
linux·运维·ubuntu
励志不掉头发的内向程序员16 小时前
【Linux系列】掌控 Linux 的脉搏:深入理解进程控制
linux·运维·服务器·开发语言·学习
東雪蓮☆16 小时前
K8s Ingress 详解与部署实战
linux·运维·kubernetes
塔能物联运维16 小时前
物联网运维中的边缘计算任务调度优化策略
运维·人工智能·物联网·边缘计算
真正的醒悟16 小时前
什么是网络割接
运维·服务器·网络