• CentOS安装nginx


    第一步:把本地文件上传到虚拟机

    第二步:解压文件
                 tar -zxvf   nginx-1.8.1.tar.gz -C /usr/local/soft/nginx             ///usr/local/soft/nginx 是之前创建的文件夹
    第三步 安装依赖:
                 yum install gcc-c++
                 yum install -y pcre pcre-devel
                 yum install -y zlib zlib-devel
                 yum install -y openssl openssl-devel 

    第四步:在 nginx解压后的目录里面,执行./configure\,生成nginx安装文件

       [root@liu ~]# cd /usr/local/soft/nginx/nginx-1.8.1/
         [root@liu nginx-1.8.1]# pwd
        /usr/local/soft/nginx/nginx-1.8.1          //这个是Nginxjar包解压后的路径               
        [root@liu nginx-1.8.1]# ./configure

     第五步:在 nginx解压后的目录里面,设置参数

        [root@liu nginx-1.8.1]#
            ./configure
            --prefix=/usr/local/nginx                                       
            --pid-path=/var/run/nginx/nginx.pid
            --lock-path=/var/lock/nginx.lock
            --error-log-path=/var/log/nginx/error.log
            --http-log-path=/var/log/nginx/access.log
            --with-http_gzip_static_module
            --http-client-body-temp-path=/var/temp/nginx/client
            --http-proxy-temp-path=/var/temp/nginx/proxy
            --http-fastcgi-temp-path=/var/temp/nginx/fastcgi
            --http-uwsgi-temp-path=/var/temp/nginx/uwsgi
            --http-scgi-temp-path=/var/temp/nginx/scgi
            注意:配置参数时
            第一个:--prefix=/usr/local/nginx \, 如果usr/local下面如果没有nginx目录手动创建一个它是用来存放Nginx服务器的地方
            第二个:--http-scgi-temp-path=/var/temp/nginx/scgi,如果var/temp目录下面没有nginx目录,手动创建一个.    


    第六步:make install
                      打开防火墙端口:80
                  /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
                  /etc/rc.d/init.d/iptables save
                 /etc/init.d/iptables status
                 测试:
                      *1.进入到sbin目录,启动前测评配置文件是否正确:
                    ./nginx –t,出现下面的话表示配置成功
                         nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
                         nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
                  *2.进入到sbin目录,启动nginx
                     ./nginx

         你可以在你的浏览器中输入你的CentOS的IP地址,如果出现了Nginx的页面就表示你安装成功了
                  *3.关闭和退出nginx
                     ==关闭命令:相当于找到nginx进程kill。
                     ./nginx -s stop
                     ==退出命令:
                    ./nginx -s quit
                    等程序执行完毕后关闭,建议使用此命令。

  • 相关阅读:
    制作openresty的docker镜像 + nginx笔记 调试rewrite和location Nginx 学习笔记
    C# winform在WebBrowser下获取完整的Cookies(包括含HTTPOnly属性的)
    vscode代码切换大小写的教程
    C#中的Guid
    .NET Framework 版本和依赖关系
    将 Excel 数据导入 SQL Server数据库
    sqlserver各版本的介绍对比
    使用 Visual Studio Code 创建并运行 Transact SQL 脚本
    SQL转Linq工具的使用——Linqer 4.6
    对象之间的映射(AutoMapper集成)
  • 原文地址:https://www.cnblogs.com/zhuguangzhe/p/7480017.html
Copyright © 2020-2023  润新知