您好,登錄后才能下訂單哦!
本篇內容主要講解“Windows系統下Nginx服務器怎么配置”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“Windows系統下Nginx服務器怎么配置”吧!
啟動nginx
cd d: cd nginx-1.2.4 start nginx
查看任務任務管理器里面會有nginx的進程
在瀏覽器輸入http://127.0.0.1 此時會出現nginx的歡迎界面,說明啟動nginx成功。
welcome to nginx! if you see this page, the nginx web server is successfully installed and working. further configuration is required. for online documentation and support please refer to nginx.org. commercial support is available at nginx.com. thank you for using nginx.
其他操作:
nginx -s stop // 停止nginx nginx -s reload // 重新加載配置文件 nginx -s quit // 退出nginx
配置文件:
#user nobody; worker_processes 1;#啟動的線程數:一本內核的數目*2 #錯誤的位置和級別 #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid;#pid進程文件的位置 events { worker_connections 1024;#每個進程的最大連接數 } http { include mime.types; default_type application/octet-stream; #nginx日志格式定義,在下面可以進行引用 #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main;#日志路徑 sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65;#請求時間 #gzip on;開啟gzip壓縮 #server為設置的虛擬機,可以設多個 server { listen 80;#監聽的端口 server_name localhost;#監聽的域名 #charset koi8-r; #access_log logs/host.access.log main;#該虛擬機日志存放的位置 location / { root html; index index.html index.htm; } #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 { root html; } # proxy the php scripts to apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the php scripts to fastcgi server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param script_filename /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of ip-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # https server # #server { # listen 443; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols sslv2 sslv3 tlsv1; # ssl_ciphers high:!anull:!md5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
小提示:
運行nginx -v可以查看該平臺編譯版支持哪些模塊。我這里的結果為:
nginx version: nginx/0.7.65 tls sni support enabled 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-openssl=objs.msvc8/lib/openssl-0.9.8k --with-openssl-opt=enable-tlsext --with-zlib=objs.msvc8/lib/zlib-1.2.3 --with-select_module --with-http_ssl_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-mail_ssl_module --with-ipv6 nginx version: nginx/0.7.65 tls sni support enabled 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-openssl=objs.msvc8/lib/openssl-0.9.8k --with-openssl-opt=enable-tlsext --with-zlib=objs.msvc8/lib/zlib-1.2.3 --with-select_module --with-http_ssl_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-mail_ssl_module --with-ipv6
查看nginx進程
tasklist /fi "imagename eq nginx.exe"
如下顯示:
到此,相信大家對“Windows系統下Nginx服務器怎么配置”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。