nginx install
系统环境:
CentOS6.6_64bit
软件版本:nginx-1.10.3.tar.gz
一、安装nginx
1、国内云服务器,请自行检查gcc
yum -y install gcc gcc-c++
2、安装组件包
#安装nginx依赖的组件
yum install pcre pcre-devel openssl openssl-devel zlib -y
#检查相关依赖的组件
rpm -qa pcre pcre-devel openssl-devel openssl zlib
3、create nginx username
useradd nginx -s /sbin/nologin -M
#检查nginx用户与用户组
id nginx
4、开始安装nginx
mkdir -p /home/nulige/tools cd /home/nulige/tools wget -q http://nginx.org/download/nginx-1.10.3.tar.gz tar xf nginx-1.10.3.tar.gz cd nginx-1.10.3 ./configure --prefix=/application/nginx-1.10.3 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module make && make install
#创建软链接 ls -ld /application/nginx-1.10.3/ ln -s /application/nginx-1.10.3/ /application/nginx ls -l /application/nginx
5、启动nginx
检查nginx语法 /application/nginx/sbin/nginx -t 启动nginx /application/nginx/sbin/nginx
6、查看启动端口
[root@web01 nginx-1.10.3]# ps -ef|grep nginx|grep -v grep
root 3576 1 0 21:48 ? 00:00:00 nginx: master process /application/nginx/sbin/nginx
nginx 3577 3576 0 21:48 ? 00:00:00 nginx: worker process
[root@web01 nginx-1.10.3]# netstat -lntup|grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3576/nginx
7、添加域名解析(本地测试用)
echo "192.168.30.134 www.nulige.com" >>/etc/hosts
tail -1 /etc/hosts
8、访问nginx主页(测试成功)