<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## 安裝Nginx 1.14.0 參考文章: [Centos6.5編譯安裝Nginx-1.6.2和簡單配置](https://my.oschina.net/kcw/blog/318309) [RedHat 7 編譯安裝Nginx 1.12并配置WEB站點](http://blog.51cto.com/jiangjianlong/2105585) [CentOS 7.2.1511編譯安裝Nginx1.10.1+MySQL5.6.33+PHP5.6.26](https://www.osyunwei.com/archives/9749.html) ### 下載Nginx源碼包 nginx下載站點:`http://nginx.org/en/download.html`,目前穩定版是`nginx-1.14.0`,我們下載源碼包: ~~~ http://nginx.org/download/nginx-1.14.0.tar.gz ~~~ 下載并解包: ~~~ [root@localhost packages]# wget http://nginx.org/download/nginx-1.14.0.tar.gz [root@localhost packages]# tar zxf nginx-1.14.0.tar.gz [root@localhost packages]# cd nginx-1.14.0 ~~~ 添加用戶和組 ~~~ [root@localhost nginx-1.14.0]# groupadd nginx [root@localhost nginx-1.14.0]# useradd -g nginx nginx ~~~ 依賴包安裝: Nginx的依賴包有:PCRE,zlib,OpenSSL。這些包我們在安裝PHP時已經安裝過了,所以不需要再安裝了。 創建目錄: 創建編譯參數中用到的目錄`/var/tmp/nginx/client/`,否則安裝完nginx后啟動會報該目錄不存在。 ~~~ [root@localhost nginx-1.14.0]# mkdir -p /var/tmp/nginx/client/ ~~~ 開始安裝: ~~~ [root@localhost nginx-1.14.0]# ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre [root@localhost nginx-1.14.0]# make [root@localhost nginx-1.14.0]# make install ~~~ 安裝完成,執行`nginx -V`檢查是否安裝成功 ~~~ [root@localhost nginx-1.14.0]# /usr/local/nginx/sbin/nginx -V ~~~ 結果如下: :-: ![](https://box.kancloud.cn/e29420fa8e1588b6bac622ffeb9d5783_748x160.jpg) 檢查Nginx環境及配置: ~~~ [root@localhost nginx-1.14.0]# /usr/local/nginx/sbin/nginx -t ~~~ 結果如下: :-: ![](https://box.kancloud.cn/e06269f7fc423fe5b7fa3a8af5c4e528_746x40.jpg) 配置nginx服務: 創建`/etc/init.d/nginx`文件 ~~~ [root@localhost nginx-1.14.0]# vim /etc/init.d/nginx ~~~ 文件內容如下: ~~~ #!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - 85 15 # description: Nginx is an HTTP(S) server, HTTP(S) reverse \ # proxy and IMAP/POP3 proxy server # processname: nginx # config: /usr/local/nginx/conf # config: /etc/sysconfig/nginx # pidfile: /var/run/nginx.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 nginx="/usr/local/nginx/sbin/nginx" prog=$(basename $nginx) NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx lockfile=/var/lock/nginx.lock make_dirs() { # make required directories user=`nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` options=`$nginx -V 2>&1 | grep 'configure arguments:'` for opt in $options; do if [ `echo $opt | grep '.*-temp-path'` ]; then value=`echo $opt | cut -d "=" -f 2` if [ ! -d "$value" ]; then # echo "creating" $value mkdir -p $value && chown -R $user $value fi fi done } start() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 make_dirs echo -n $"Starting $prog: " daemon $nginx -c $NGINX_CONF_FILE retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { configtest || return $? stop sleep 1 start } reload() { configtest || return $? echo -n $"Reloading $prog: " killproc $nginx -HUP RETVAL=$? echo } force_reload() { restart } configtest() { $nginx -t -c $NGINX_CONF_FILE } rh_status() { status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" exit 2 esac ~~~ 創建日志目錄: ~~~ [root@localhost nginx-1.14.0]# mkdir /usr/local/nginx/logs [root@localhost nginx-1.14.0]# chown -R www.www /usr/local/nginx/logs ~~~ 加入服務: ~~~ [root@localhost nginx-1.14.0]# chmod a+wrx /etc/init.d/nginx [root@localhost nginx-1.14.0]# chkconfig --add nginx [root@localhost nginx-1.14.0]# chkconfig nginx on ~~~ 啟動服務: ~~~ [root@localhost nginx-1.14.0]# service nginx start [root@localhost nginx-1.14.0]# service nginx status ~~~ :-: ![](https://box.kancloud.cn/edb55dc6d8f36cd52131dc685d5734ff_746x209.jpg) 關閉防火墻: ~~~ [root@localhost nginx-1.14.0]# systemctl stop firewalld.service #停止firewall [root@localhost nginx-1.14.0]# systemctl disable firewalld.service #禁止firewall開機啟動 ~~~ 關閉SELINUX: ~~~ [root@localhost nginx-1.14.0]# vi /etc/selinux/config #SELINUX=enforcing #注釋掉 #SELINUXTYPE=targeted #注釋掉 SELINUX=disabled #增加 :wq! #保存退出 setenforce 0 #使配置立即生效 ~~~ 安裝iptables防火墻: ~~~ [root@localhost nginx-1.14.0]# yum install iptables-services #安裝 [root@localhost nginx-1.14.0]# vi /etc/sysconfig/iptables #編輯防火墻配置文件 # sample configuration for iptables service # you can edit this manually or use system-config-firewall # please do not ask us to add additional ports/services to this default configuration *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT :wq! #保存退出 systemctl restart iptables.service #最后重啟防火墻使配置生效 systemctl enable iptables.service #設置防火墻開機啟動 /usr/libexec/iptables/iptables.init restart #重啟防火墻 ~~~ 測試訪問: 通過ip訪問服務器 :-: ![](https://box.kancloud.cn/c258893f0633fb8149345fa8044cfc5e_561x218.jpg) Nginx安裝完成。關閉虛擬機,拍個快照吧 配置虛擬主機 編輯`/usr/local/nginx/conf/nginx.conf`,在最后的花括號“}”上一行增加一行:`include vhost/*.conf;`,保存。 創建目錄vhost: ~~~ [root@localhost nginx-1.14.0]# mkdir /usr/loca/nginx/conf/vhost ~~~ 在vhost目錄下創建虛擬主機配置文件即可,擴展名為`.conf`,內容為: ~~~ server { listen 80; server_name www.abc.com; location / { root /data/www/abc/public; index index.php index.html index.htm; } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看