标签搜索

目 录CONTENT

文章目录

Nginx 安装配置

陈铭
2023-05-07 / 0 评论 / 0 点赞 / 125 阅读 / 160 字 / 正在检测是否收录...

安装

rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install -y nginx

# 启动
nginx
# 关闭
nginx -s quit
# 重启
nginx -s reload

配置

nginx默认会读取/etc/nginx/nginx.conf,而nginx.conf会加载conf.d下的所有*.conf配置(里面有一句,include /etc/nginx/conf.d/*.conf;)

cd /etc/nginx/conf.d/

# 暂时没有域名,配置了http协议的80端口
vim cem80.conf

# cem80.conf完整内容如下
# 即所有80端口的/rycem/api/**请求都会转到http://127.0.0.1:8081/rycem/api/**
server {
    listen       80;
    location /rycem/api/ {
        #proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://127.0.0.1:8081$request_uri;
    }
}
0

评论区