1. 程式人生 > >(轉)nginx的下載與安裝

(轉)nginx的下載與安裝

下載地址

我下載的是nginx-1.10.1版本,官方說是最新穩定版

解壓到資料夾;我解壓到D盤目錄下,並重命名資料夾為nginx

雙擊nginx.exe啟動

訪問locahost

該頁面為預設頁面,可以根據具體需求修改;

1、修改預設網頁內容 - nginx/html/index.html

2、修改配置路徑 - nginx/conf/nginx.conf,root後面的html可以改為自己的網頁存放路徑;如"d:/ershuai;",index後面的內容是路徑下網頁名稱

(預設配置是 html路徑下的index.html,如果沒有index.html再去找index.htm)

相關命令

1、啟動: C:\server\nginx-1.0.2>start nginx 或 C:\server\nginx-1.0.2>nginx.exe 2、停止: C:\server\nginx-1.0.2>nginx.exe -s stop 或 C:\server\nginx-1.0.2>nginx.exe -s quit 注:stop是快速停止nginx,可能並不儲存相關資訊;quit是完整有序的停止nginx,並儲存相關資訊。 3、重新載入Nginx: C:\server\nginx-1.0.2>nginx.exe -s reload 當配置資訊修改,需要重新載入這些配置時使用此命令。 4、重新開啟日誌檔案: C:\server\nginx-1.0.2>nginx.exe -s reopen 5、檢視Nginx版本: C:\server\nginx-1.0.2>nginx -v nginx: nginx version: nginx/1.0.2 或 C:\server\nginx-1.0.2>nginx -V nginx: nginx version: nginx/1.0.2  nginx: TLS SNI support enabled  nginx: configure arguments: --builddir=objs.msvc8 --crossbuild=win32 --with-debug --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs.msvc8/lib/pcre-7.9 --with-zlib=objs.msvc8/lib/zlib-1.2.3 --with-select_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-mail --with-ipv6 --with-openssl=objs.msvc8/lib/openssl-0.9.8r --with-openssl-opt=enable-tlsext --with-http_ssl_module --with-mail_ssl_module 注:v只是簡單顯示版本資訊,V不但顯示版本資訊,還顯示配置引數資訊。 6、測試或載入指定配置檔案: 測試配置檔案 C:\server\nginx-1.0.2>nginx.exe -t -c conf/default.conf nginx: the configuration file C:\server\nginx-1.0.2/conf/default.conf syntax isok nginx: configuration file C:\server\nginx-1.0.2/conf/default.conf test is successful 載入指定配置檔案 C:\server\nginx-1.0.2>start nginx.exe -c conf/default.conf