Centos安装nginx流程

安装步骤

cd usr/local
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
mkdir nginx
cd nginx/
wget http://nginx.org/download/nginx-1.13.7.tar.gz
tar -xvf nginx-1.13.7.tar.gz
cd nginx-1.13.7
./configure --with-http_stub_status_module --with-http_ssl_module
make
make install
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

安装过程中问题

  • 执行make过程中报错
make -f objs/Makefile
make[1]: Entering directory '/usr/local/nginx/nginx-1.13.7'
cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
        -o objs/src/os/unix/ngx_user.o \
        src/os/unix/ngx_user.c
src/os/unix/ngx_user.c: In function ‘ngx_libc_crypt’:
src/os/unix/ngx_user.c:26:7: error: ‘struct crypt_data’ has no member named ‘current_salt’
     cd.current_salt[0] = ~salt[0];
       ^
make[1]: *** [objs/Makefile:791: objs/src/os/unix/ngx_user.o] Error 1
make[1]: Leaving directory '/usr/local/nginx/nginx-1.13.7'
make: *** [Makefile:8: build] Error 2

修改 vim objs/Makefile 将-Werror去掉

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CentOS安装 Nginx 正向代理 https,可以按照以下步骤进行: 1. 安装 NginxCentOS 中,可以使用以下命令安装 Nginx: ``` sudo yum update sudo yum install nginx ``` 2. 配置 SSL 证书 在 Nginx 中,需要使用 SSL 证书来启用 HTTPS,可以通过以下步骤来配置 SSL 证书: 1) 在服务器上安装 SSL 证书,可以通过购买 SSL 证书或使用 Let's Encrypt 免费证书。 2) 在 Nginx 配置文件中添加以下代码: ``` server { listen 443 ssl; server_name example.com; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/key.pem; location / { proxy_pass http://localhost:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } ``` 其中,/path/to/cert.pem 和 /path/to/key.pem 替换为您的 SSL 证书和密钥的路径。 3. 配置 Nginx 正向代理 在 Nginx 中,可以使用 proxy_pass 指令来实现正向代理,可以通过以下步骤来配置 Nginx 正向代理: 1) 在 Nginx 配置文件中添加以下代码: ``` server { listen 80; server_name example.com; location / { proxy_pass https://www.example.com; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } ``` 其中,example.com 替换为您的域名,https://www.example.com 替换为您需要代理的网站地址。 2) 重新加载 Nginx 配置文件: ``` sudo nginx -t sudo nginx -s reload ``` 上述命令将测试 Nginx 配置文件的语法,并重新加载配置文件。 现在您已经成功地在 CentOS安装Nginx 正向代理 HTTPS,并配置了 SSL 证书和正向代理。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值