zoukankan      html  css  js  c++  java
  • 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
                    等程序执行完毕后关闭,建议使用此命令。

  • 相关阅读:
    How to run Java main class and pass application arguments in Maven?
    【转】三年后再反思我的" Java Web项目管理得失谈"
    Object.keys()
    angular $resource 的 get请求 和 post请求
    vue 自定义 移动端筛选条件
    获取当前时间 YYYY-MM-DD
    vue-router 二级路由
    blob 对象 实现分片上传 及 显示进度条
    js性能优化之函数节流(分流函数)
    vue + vue-lazyload 实现图片懒加载
  • 原文地址:https://www.cnblogs.com/zhuguangzhe/p/7480017.html
Copyright © 2011-2022 走看看