安装Nginx(Linux)

安装Nginx

安装

[root@iZ0s0dama8ff4xZ ~]# yum list nginx
Last metadata expiration check: 2:15:43 ago on Fri 14 Feb 2025 07:47:34 AM CST.
Available Packages
nginx.x86_64   
[root@iZ0s0dama8ff4xZ ~]# yum install nginx.x86_64
# 配置文件地址
[root@iZ0s0dama8ff4xZ ~]# cd /etc/nginx/conf.d/
# simpleiot项目配置文件(这里根据你自己项目创建,我的项目名叫simpleiot)
[root@iZ0s0dama8ff4xZ conf.d]# vim simpleiot.cn.conf 
server {
        listen       80;
        server_name  simpleiot.cn;

        location / {
                        add_header Cache-Control no-cache;
            root   /data/www/kmcrm/web/dist;
            index  index.html index.htm;
           # try_files $uri $uri/;
             try_files $uri $uri/ /index.html;
        }
        location /api/ {
            rewrite ^/api/(.*)$ /$1 break;
            proxy_pass 'http://127.0.0.1:6092';
        }
        # location /file/ {
        #    rewrite ^/file/(.*)$ /$1 break;
        #    proxy_pass 'http://127.0.0.1:8012/';
        #}
        #location /webroot/decision {
        #proxy_pass 'http://127.0.0.1:28080/webroot/decision';
        #       }
        location = /50x.html {
            root   html;
        }
    }

nginx 启动

# 设置 Nginx 在系统启动时自动启动
systemctl enable nginx
# 查看状态
systemctl status nginx
# 启动
systemctl start nginx
# 重启
systemctl restart nginx
# 重新加载 Nginx 配置
systemctl reload nginx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值