zoukankan      html  css  js  c++  java
  • CentOS6.2编译安装Nginx1.2.0

    第一步:下载nginx源码包和所需要的库文件。

    cd /tmp
    #Nginx1.2.0 wget http://www.nginx.org/download/nginx-1.2.0.tar.gz #Nginx(pcre) wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.13.tar.gz

    也可以使用yum install pcre 自动安装pcre库

    第二步:开始安装nginx

    复制代码
    #安装Nginx
    tar -zxvf nginx-1.2.0.tar.gz && cd nginx-1.2.0 &&
    ./configure --user=www --group=www \
    --prefix=/usr/local/webserver/nginx \
    --sbin-path=/usr/local/webserver/nginx/sbin/nginx \
    --conf-path=/usr/local/webserver/nginx/conf/nginx.conf \
    --with-http_stub_status_module \
    --with-http_ssl_module \
    --with-pcre \
    --lock-path=/var/run/nginx.lock \
    --pid-path=/var/run/nginx.pid
    编译完成没错误后,执行以下命令 make
    && make install && cd ../
    复制代码

    第三步:更改配置

    复制代码
    #更改配置
    vi /usr/local/webserver/nginx/conf/nginx.conf
    
    #修改一些参数,别直接替换文件,这只是一部分
    user www
    
    events {
        use epoll;
        worker_connections  1024;
    }
    listen       80;
    server_name localhost;
    index    index.html index.htm index.php;
    root      /var/www/html;
    location ~ .*\.(php|php5)?$
    { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } #注意这里 #$document_root$fastcgi_script_name; #检测配置文件 /usr/local/webserver/nginx/sbin/nginx -t #提示表示成功 #nginx: the configuration file /usr/local/webserver/nginx/conf/nginx.conf syntax is ok #nginx: configuration file /usr/local/webserver/nginx/conf/nginx.conf test is successful #开启Nginx /usr/local/webserver/nginx/sbin/nginx #平滑重启Nginx /usr/local/webserver/nginx/sbin/nginx -s reload #添加开机启动 vi /etc/rc.d/rc.local #最后一行加入 /usr/local/webserver/nginx/sbin/nginx &

    复制代码

    第四步:测试

    vi /var/www/html/index.php
    #新建index文件,输入
    <?php
    phpinfo();
    ?>

    如果出现我们最熟悉的蓝色界面以及内容,就说明成功啦!

  • 相关阅读:
    公交/地铁出行测试用例点
    python第一次作业
    jmeter之jsonpath断言
    jsonhandle与jsonpath extractor(json值提取插件)
    jmeter 插件之Dummy samper-----------------moke服务
    jmeter插件安装
    JMeter组件之Test Fragment
    jmeter连接MySQL构造大量并发测试数据
    某购物网站大量用户登录脚本
    jenkins+ant+jmeter接口测试自动化平台(带发送附件测试报告)
  • 原文地址:https://www.cnblogs.com/cnsanshao/p/2570013.html
Copyright © 2011-2022 走看看