安装Nginx的详细操作
详见本人其他博客
总结Nginx安装命令:
安装Nginx总结:
-下载地址:https://nginx.org/download/nginx-1.14.2.tar.gz
- 安装准备:Nginx依赖于 pcre 库,要先安装 pcre
- 以下输入以下命令:
yum install pcre pcre-devel
cd /usr/local
wget https://nginx.org/download/nginx-1.14.2.tar.gz
tar zxcf nginx-1.14.2.tar.gz
cd nginx-1.14.2.tar.gz
cd nginx-1.14.2
./configure --prefix=/usr/local/nginx
make && make install
启动Nginx:
- cd /usr/local/nginx
看到如下4个目录:
./
… conf 配置文件
…html 网页文件
…logs 日志文件
…sbin 主要二进制文件
- 进入到启动 nginx 的二进制文件所在目录:
[root@localhost nginx]# cd /usr/local
[root@localhost local]# ls
bin etc games include lib lib64 libexec nginx sbin share src
[root@localhost local]# cd nginx
[root@localhost nginx]# ls
conf html logs sbin
[root@localhost nginx]# cd sbin/
[root@localhost sbin]# ls
nginx
[root@localhost sbin]# cd ..
- 启动Nginx命令:
[root@localhost nginx]# ./sbin/nginx
- 可以通过命令行判断Nginx是否已经启动:
[root@localhost nginx]# ps -ef | grep nginx
root 7292 1 0 20:08 ? 00:00:00 nginx: master process ./sbin/nginx
nobody 7294 7292 0 20:08 ? 00:00:00 nginx: worker process
root 7374 3461 0 20:13 pts/0 00:00:00 grep --color=auto nginx