Nginx简单安装配置

nginx安装与调试

nginx常用配置----作为web服务端
https://blog.csdn.net/wangzhenyu177/article/details/78679053
 

Nginx安装配置,支持http以及https

https://blog.csdn.net/u013992330/article/details/79740692


北风 Nginx 本教程的安装路径:

--prefix=/server/nginx  

在 /server/nginx  路径下

2) 启动:

   /server/nginx/sbin/nginx 

3) 关闭nginx:

   ps -ef|grep nginx

   kill nginxpid

扫描二维码关注公众号,回复: 5797622 查看本文章

   kill 12000

   

//平滑退出 :

kill -QUIT pid进程号;

//查看apache的运行状态

service httpd status

//httpd启动运行

service httpd start

//httpd启动停止

service httpd stop

/***************** 注意  *********************/

 apache : httpd不能与 nginx同时运行;

////////////////////////////////////////////////

wget localhost

cat index.html

Nginx配置文件做个软链接 (目的方便修改): 

ln -s conf/nginx.conf /etc/nginx.conf

//恢复nginx.conf为原来的状态:

cp conf/nginx.conf.default conf/nginx.conf

Nginx.conf 文件结构:

#全局块

worker_processes  1;

#事件块

events {

    ........

}

//http块,整个服务器的配置;

http {

    ......

    ......

    #每个虚拟主机,就会有一个server的代码块

    server {

        ...

        #每个location代表一个地址,允许出现多个;

        location{}

        location{}

    }

}

#events块

events {

    use epoll; #选择何种事件驱动 select/poll/epoll(linux内核2.6以上默认的驱动模型)

    worker_connections  1024; #配置处理的连接数;(一个工作进程最多可以处理的连接数)

}

根据硬件和服务器配置进行修改:

worker_processes * worker_connections : 总共能处理的连接数的上限;

//平滑退出 :

kill -QUIT pid进程号;

安装Ngxin --- 源码安装方式

正式安装前,编译环境 gcc g++开发库之类的需要提前装好。

若没有可以yum install gcc gcc-c++

1:选定源码目录(通常情况下放到自己的home目录或者/usr/local/src),即软件包下载的存放位置:

2:安装PCRE(以支持nginx的rewrite) yum install pcre pcre-devel

3:安装zlib库(以支持nginx的gzip压缩) yum install zlib

4:安装SSL yum install openssl openssl-devel

5:安装nginx(下载源码,然后解压,configure、make、 make install 四步)

6:启动Nginx

  查看端口80占用情况:netstat -ano|grep 80

  进入到nginx安装目录 :/server/nginx/sbin/nginx

  

Nginx常用命令:

  修改配置文件然后重启动

  nginx -s reload

  

  测试配置文件语法是否正确

  nginx -t

  

  关闭nginx:

  ps -ef|grep nginx

  kill nginxpid

  kill 12000

比如关闭 Nginx :{

[root@bigdata01 nginx]# ps -ef|grep nginx

root     12000     1  0 13:11 ?        00:00:00 nginx: master process /server/nginx/sbin/nginx

nobody   12003 12000  0 13:11 ?        00:00:00 nginx: worker process   

root     13927 10995  0 23:19 pts/5    00:00:00 grep nginx

kill 12000

}

  

步骤一 ): configure的极简配置:

./configure --prefix=/server/nginx   

/server(自己手动建立的,与服务器相关的都安装到这里)

configure的其他配置:

./configure --prefix=/server/nginx/

            --with-http_ssl_module

            --with-pcre=/usr/local/src/pcre-4.4

            --with-zlib=/usr/local/src/zlib-1.1.3

            

先按照步骤一进行:

1) 路径: /home/user01/software/nginx-1.14.0

   configure --prefix...

2) 在该路径下 执行 make 命令 ;

3) 在该路径下 执行 make install 命令;

检查 Apache的状态 (centos6 用 service 命令 )

service httpd status

  

  

Configuration summary

  + using system PCRE library

  + OpenSSL library is not used

  + using system zlib library

  nginx path prefix: "/server/nginx"

  nginx binary file: "/server/nginx/sbin/nginx"

  nginx modules path: "/server/nginx/modules"

  nginx configuration prefix: "/server/nginx/conf"

  nginx configuration file: "/server/nginx/conf/nginx.conf"

  nginx pid file: "/server/nginx/logs/nginx.pid"

  nginx error log file: "/server/nginx/logs/error.log"

  nginx http access log file: "/server/nginx/logs/access.log"

  nginx http client request body temporary files: "client_body_temp"

  nginx http proxy temporary files: "proxy_temp"

  nginx http fastcgi temporary files: "fastcgi_temp"

  nginx http uwsgi temporary files: "uwsgi_temp"

  nginx http scgi temporary files: "scgi_temp"

  

 Linux下源码安装nginx-1.9.11

 https://blog.csdn.net/hsd2012/article/details/51376674

 Nginx 安装与配置:

 https://blog.csdn.net/zgl_dm/article/details/8167128

 源码安装nginx以及平滑升级

 https://www.cnblogs.com/yinzhengjie/p/6055242.html

 Nginx源码安装

 https://www.cnblogs.com/wazy/p/8108824.html

初步了解go语言中的并行

https://blog.csdn.net/hsd2012/article/details/80047836

SSH 秘钥Key的简介以及生成和使用

https://blog.csdn.net/hsd2012/article/details/79469747

猜你喜欢

转载自blog.csdn.net/happylzs2008/article/details/89042273