編譯安裝nginx並啓動

官網:nginx.org 複製安裝連接nginx

下載安裝壓縮包:web

wget https://nginx.org/download/nginx-1.16.0.tar.gz

解壓壓縮包:tcp

tar -xzf nginx-1.16.0.tar.gz

編譯nginx

進入剛剛解壓的文件夾ui

cd nginx-1.16.0

指定安裝目錄在/home/nginx:code

./configure --prefix=/home/nginx

編譯安裝錯誤一: checking for C compiler ... not found ./configure: error: C compiler cc is not found 解決方案:yum install gcc進程

編譯安裝錯誤二: ./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option. 解決方案:yum -y install pcre-develip

編譯安裝錯誤三: ./configure: error: the HTTP gzip module requires the zlib library. You can either disable the module by using --without-http_gzip_module option, or install the zlib library into the system, or build the zlib library statically from the source with nginx by using --with-zlib=<path> option. 解決方案: yum install -y zlib-develget

nginx path prefix: "/home/nginx" nginx binary file: "/home/nginx/sbin/nginx" nginx modules path: "/home/nginx/modules" nginx configuration prefix: "/home/nginx/conf" nginx configuration file: "/home/nginx/conf/nginx.conf" nginx pid file: "/home/nginx/logs/nginx.pid" nginx error log file: "/home/nginx/logs/error.log" nginx http access log file: "/home/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp" Objs:nginx中間文件cmd

最後進行編譯:it

make
Make install

啓動nginx

進入sbin 文件夾進行啓動:./nginx

查看啓動的進程

ps -ef | grep nginx

問題: 啓動後web沒法訪問:

解決方法: 在防火牆上開啓80端口

firewall-cmd --permanent --add-port=80/tcp

重啓 防火牆

firewall-cmd --reload
相關文章
相關標籤/搜索