源码安装nginx

1.nginx下载地址  

链接:https://pan.baidu.com/s/1OJ91YU_ZywefWKJOIM8gFg
提取码:3rcj

2.解压  [root@10-100-10-21 nginx-1.4.7]# tar -xf nginx-1.4.7.tar.gz

3.  安装c语言解释器、加密、解密   [root@10-100-10-21 nginx-1.4.7]#    yum -y instll gcc pcre-devel openssl-devel make 

4.  [root@10-100-10-21 nginx-1.4.7] ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module

5.编译、安装 [root@10-100-10-21 nginx-1.4.7]  make && make install

6.开启服务  [root@10-100-10-21 nginx-1.4.7]    /usr/local/nginx/sbin/nginx  停止服务     [root@10-100-10-21 nginx-1.4.7]    /usr/local/nginx/sbin/nginx -s stop  [root@10-100-10-21 nginx-1.4.7]    /usr/local/nginx/sbin/nginx -s reload重新加载配置文件

7.查看进程 ps -ef|grep nginx     查看端口  netstat -anplt|grep nginx       a代表查看所有端口   n 以数字形式显示端口   p 显示监听端口的服务名称是什么   l 正在服务正在监听得端口信息  t显示tcp连接端口

8.配置用户    yum -y install httpd-tools 、htpasswd -c /usr/local/nginx/pass tom

9.配置域名解析主机

 9.配置密钥

[root@10-100-10-21 ~]cd /usr/local/nginx/conf/

[root@10-100-10-21 conf]openssl genrsa > cert.key  //生成私钥

[root@10-100-10-21 conf]openssl req -new -x509 -key cert.key >cert.pen //生成证书

原文地址:https://www.cnblogs.com/xuzhongtao/p/15727517.html