Nginx安装:源码安装
- 添加普通用户账号来运行nginx:
useradd nginx -M -r -s /sbin/nologin - 安装依赖包
yum install -y gcc pcre-devel openssl-devel - 解压并安装Nginx:
wget http://nginx.org/download/nginx-1.10.3.tar.gz
tar xvf nginx-1.10.3.tar.gz
cd nginx-1.10.3
./configure --user=nginx \
--group=nginx \
--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_gzip_static_module
make && make install
4.创建软链接文件
ln -s /usr/local/nginx/sbin/nginx /sbin/nginx
5.启动:
检测配置文件语法 nginx -t
启动nginx服务 nginx
6.查看启动状态:
ps aux | grep nginx
root 8416 0.0 0.1 5760 660 ? Ss 23:29 0:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nginx 8417 0.0 0.1 5904 992 ? S 23:29 0:00 nginx: worker process
netstat -ntlp | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* listen 8416/nginx.conf
这样我们的nginx源码安装就完成了
原文地址:https://blog.51cto.com/14268436/2386838
时间: 2024-11-08 12:34:14