Nginx 功能说明与配置说明.
理论基础
Nginx服务安装启动
- 官网下载Nginx直接解压
wget http://nginx.org/download/nginx-1.20.2.tar.gz
tar -zxvf nginx-1.20.2.tar.gz
cd nginx
./configure --prefix=/usr/local/nginx
- make
- make install
运维
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
启动
自启动:
1 | [Unit] |
systemctl daemon-reload
systemctl restart nginx.service
80 443 端口需要root权限,要用其他权限启动要做些调整。
错误
./configure: error: the HTTP rewrite module requires the PCRE library.
安装pcre-devel解决问题
yum -y install pcre-devel
./configure: error: the HTTP gzip module requires the zlib library.
安装zlib-devel解决问题
yum install -y zlib-devel
cp: ‘conf/koi-win’ and ‘/usr/local/nginx/conf/koi-win’ are the same file
make[1]: * [install] Error 1
make[1]: Leaving directory `/usr/local/nginx’
make: * [install] Error 2
解决办法:就是你把nginx的待安装文件放在了nginx的默认安装路径上,把tar包 放到除了 /usr/local 目录的其他路径