nginx 安装命令地址:https://www.runoob.com/linux/nginx-install-setup.html
基本启动命令:
需要停止或者重启nginx的命令如下
/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx -s reload
发现报以下错误:
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)
解决办法,执行以下语法即可修复:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
安装步骤:
1.
下载 Nginx,下载地址:http://nginx.org/download/nginx-1.6.2.tar.gz
[root@bogon src]# cd /usr/local/src/ [root@bogon src]# wget http://nginx.org/download/nginx-1.6.2.tar.gz
2 .[root@bogon src]# tar zxvf nginx-1.6.2.tar.gz
3.进入解压后的目录
[root@bogon src]# cd nginx-1.6.2
4.--with-openssl=/usr/local/ssl是opensll的安装路径,此命令是编译
[root@iZbp1cd2l7ux0lqekyijt8Z ~]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-openssl=/usr/local/ssl --with-http_ssl_module --with-file-aio --with-http_realip_module
[root@bogon nginx-1.6.2]# make [root@bogon nginx-1.6.2]# make install
5.安装后查询版本信息
[root@bogon nginx-1.6.2]# /usr/local/webserver/nginx/sbin/nginx -v
6.检查配置文件是否正确
[root@bogon conf]# /usr/local/webserver/nginx/sbin/nginx -t
7.开启服务器
[root@bogon conf]# /usr/local/webserver/nginx/sbin/nginx