一、安装编译工具及库文件
yum -y install gcc
yum -y install gcc-c++
yum -y install zlib;
yum -y install pcre-devel
yum -y install openssl openssl-devel
二、下载安装包
wget -c https://nginx.org/download/nginx-1.10.3.tar.gz
tar -zxvfnginx-1.10.3.tar.gz
cd nginx-1.8.0
设置编译路径为 /usr/local/nginx
./configure --prefix=/usr/local/nginx
三、编译安装
make
make install
启动Nginx,执行以下命令:
./nginx -s reload
error:
-bash: ./nginx: No such file or directory
执行
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
四、设置开机启动
systemctl status nginx
Error:Unit nginx.service could not be found.
Solution:
[ISSUE] [Centos] Centos Start Nginx Show: Failed to start nginx.service:unit not found
service nginx start
Starting nginx (via systemctl): [ OK ]
原文地址:https://www.cnblogs.com/dreamtaker/p/8550153.html
时间: 2024-10-03 12:26:15