离线安装nginx

文件在资源里

1,解压nginx,放在home里

如果有网,可以直接下载依赖
yum install openssl-devel

2,进入解压后的nginx文件夹里执行:
iii 自定义文件名称,吧zlib和pcre解压到该文件夹下
pcre 下载地址:https://www.pcre.org/
zlib 下载地址:

./configure --with-zlib=/usr/local/iii/zlib-1.3.1 --with-pcre=/usr/local/iii/pcre-8.44

还有个openssl的配置,是使用https需要的非必须 下载地址:https://openssl-library.org/source/
和上面一样解压,指定目录即可

执行完成后编译

make && make install

编译完成后在 /usr/local/ 下就会有nginx目录 进入sbin 执行命令

启动      ./nginx  
停止      ./nginx -s stop
重启命令  ./nginx -s reload

如果报错:

nginx: [emerg] unknown “connection_upgrade” variable
nginx: configuration file /www/server/nginx/conf/nginx.conf test failed
解决方法
在nginx配置文件http标签下添加如下几行:

map $http_upgrade $connection_upgrade {
       default upgrade;
       ''      close;
   }

你可能感兴趣的:(nginx,运维)