環境準備:先安裝準備環境
yum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel
解壓安裝包:
編譯nginx:
--with-pcre生成指令碼及配置檔案:make
安裝:make install
通過命令啟動和關閉nginx
啟動 /usr/local/nginx/sbin/nginx如果報錯,在網上找相應的解決方法
/usr/local/nginx/sbin/nginx/nginx #啟動 服務
/usr/local/nginx/sbin/nginx/nginx -s reload #不停止服務重讀配置檔案
/usr/local/nginx/sbin/nginx/nginx -s stop #停止服務 #停止服務servernginx 主配置檔案:nginx.conf
location ~ \.php$
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#error_page 500 502 503 504 /50x.html;
location = /50x.html
# proxy the php scripts to apache listening on 127.0.0.1:80
##location ~ \.php$
# pass the php scripts to fastcgi server listening on 127.0.0.1:9000
##location ~ \.php$
# deny access to .htaccess files, if apache's document root
# concurs with nginx's one
##location ~ /\.ht
}重啟nginx,
在根目錄的檔案中建立乙個php檔案,在瀏覽器中用ip就能訪問了
nginx 編譯安裝與配置
首先上nginx的官網 瀏覽相應版本 download nginx 1.10.3.tar.gz download nginx 1.12.0.tar.gz 新建乙個普通使用者,禁系統登入 m 表示不自動建立使用者目錄 useradd nginx s sbin nologin m 解壓原始碼包後進入原始...
nginx編譯和安裝
1nginx的編譯安裝 nginx的安裝 cd nginx源包路徑 with pcre pcre源包路徑 add module 上傳模組源包路徑 接下來是常見的 make make install 安裝完後就可以直接用 nginx命令了 開啟服務 nginx 停止服務 nginx s stop 注 ...
nginx 安裝和配置
nginx安裝 step1 在modules目錄下建立nginx目錄 root master mkdir opt modules nginx root master wget step3 解壓到指定目錄 root master tar zxf tengine 2.0.2.tar.gz opt mod...