随笔 - 153  文章 - 0  评论 - 4  阅读 - 49355

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

 yum -y install gcc automake autoconf libtool make

 

cd /usr/local/nginx/conf

vi nginx.conf

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

# 查看

./nginx -v

./nginx -V

[root@ecm-8c53-0001 sbin]# ./nginx -V
nginx version: nginx/1.16.1
built by gcc 8.5.0 20210514 (Anolis 8.5.0-22.0.1) (GCC)
built with OpenSSL 1.1.1k FIPS 25 Mar 2021
TLS SNI support enabled
configure arguments: --user=nginx --prefix=/usr/local/nginx --with-http_ssl_module --with-http_realip_module --with-http_image_filter_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_stub_status_module --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --without-http_rewrite_module

 

 

# 重新加载
./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

 报错

checking for C compiler 

 yum -y install gcc

yum -y install make zlib-devel gcc-c++ libtool openssl openssl-devel

可能没联网--配置代理 

vi /etc/yum.conf
proxy=http://XXX.XXX.XX.XXX:3128

-----------------------------------------------------------------------

 sudo yum install pcre pcre-devel

 yum -y install openssl openssl-devel

 

 

 

 

---------------------------------------------------------

./configure  ok 才能 make + make install

--------------------------------------------------------

 

 

启动失败 nginx: [emerg] getpwnam("nginx") failed

[root@ecm-8c53-0001 sbin]# ./nginx
nginx: [emerg] getpwnam("nginx") failed

 useradd -M -s /sbin/nologin nginx

 

posted on   daofree  阅读(27)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示