CentOS 7.4 64位安装Nginx或重启

https://www.cnblogs.com/ghzjm/p/10677599.html

nginx转发tomcat

https://www.cnblogs.com/swbzmx/p/8845810.html

 

 

Xshell 链接好服务器

yum install -y pcre pcre-devel

 

 

 

 

yum install -y zlib zlib-devel

 

 

 

yum install gcc-c++   (y)
yum install -y openssl openssl-devel

安装nginx,1.14.0

wget -c https://nginx.org/download/nginx-1.14.0.tar.gz

 

 

 解压并进入nginx目录

tar -zxvf nginx-1.14.0.tar.gz
cd nginx-1.14.0

使用nginx的默认配置

./configure

 

 

编译安装

make

 

make install

 

 

 查找安装路径:

whereis nginx

 

 

 

 

 

 原

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

改为

 server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/local/nginx/html;
            index  index.html index.htm;
        }

 

进入sbin目录,可以看到有一个可执行文件nginx,直接./执行就OK了。

cd /usr/local/nginx/sbin/

cd nginx/
cd sbin/
./nginx

 

运行起来之后访问服务器ip,可以看到nginx的欢迎页面

 

 

 

ps -ef|grep nginx

 

 

 

kill -QUIT 6052
ps -ef|grep nginx

 

kill -QUIT 6068
./nginx -s reload

 

 解决办法

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

然后再

./nginx -s reload

 

 如果如上图有nginx的进程说明启动好了这个时候如果无法访问nginx页面可以先查看一下你服务器的安全组策略是否有启用80端口

 

 

 然后再去访问    正常的域名访问就行

 

 

nginx所在位置

 

posted @ 2020-01-13 15:09  ThisCall  阅读(265)  评论(0编辑  收藏  举报