nginx部署

 

windows

location / {
root D:\\nginx-1.24.0\\html\\dist;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}

 

location /api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9001;
}

 

 

Linux

yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

cd /usr/local

mkdir nginx

cd nginx

wget http://nginx.org/download/nginx-1.13.7.tar.gz

tar -zxvf nginx-1.13.7.tar.gz

cd nginx-1.13.7

./configure --with-http_ssl_module
# 编译flv模块
# ./configure --add-module=../nginx-http-flv-module-master --with-http_ssl_module --with-http_ssl_module --with-http_xslt_module --with-http_flv_module --with-debug --with-http_gzip_static_module --with-http_auth_request_module

vi objs/Makefile
# 编译 报错可能:打开objs/Makefile 删除werror

make

make install

cd /usr/local/nginx/conf

vi nginx.conf

# 启动
./usr/local/nginx/sbin/nginx

# 重新加载
./usr/local/nginx/sbin/nginx -s reload

配置nginx.conf

server {
listen 9001;
server_name localhost;
root /usr/local/xxx/dist;
location / {
index /index.html;
try_files $uri $uri/ /index.html;
}

}

 

443证书配置

https://help.aliyun.com/zh/ssl-certificate/user-guide/install-ssl-certificates-on-nginx-servers-or-tengine-servers?spm=a2c4g.11186623.0.0.62363359oJSo7Z

 

posted on 2023-08-09 18:23  daofree  阅读(24)  评论(0编辑  收藏  举报