国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > Nginx > 正文

Windows Server 2016 Nginx 安裝配置詳細圖文教程

2024-08-30 12:29:06
字體:
來源:轉載
供稿:網友
Server2016,Nginx,安裝配置

1、下載Nginx

官網地址:
http://nginx.org/
下載地址:
http://nginx.org/en/download.html

 Server2016,Nginx,安裝配置

2、下載Windows Service Wrapper


官網地址:
https://github.com/kohsuke/winsw/
下載地址:
http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/


Server2016,Nginx,安裝配置 
Server2016,Nginx,安裝配置

3、解壓Nginx壓縮包文件到C盤根目錄,并且重命名為nginx

Server2016,Nginx,安裝配置

4、將"winsw-1.19-bin.exe"重命名為"nginx-service.exe",并且復制到nginx根目錄


Server2016,Nginx,安裝配置

5、在nginx根目錄編寫nginx-service.xml文件


Server2016,Nginx,安裝配置

 nginx-service.xml文件內容

<?xml version="1.0" encoding="UTF-8" ?><service> <id>Nginx</id> <name>Nginx</name> <description>本服務用于加載Nginx服務,請確保開機啟動。</description> <logpath>C:/nginx/logs</logpath> <executable>nginx.exe</executable> <stopexecutable>nginx.exe</stopexecutable> <stopargument>-s</stopargument>  <stopargument>stop</stopargument> <logmode>rotate</logmode></service>

 6、安裝Nginx系統服務或者卸載Nginx系統服務

6.1、安裝Nginx系統服務
按下Win+X+A鍵
打開命令提示符(管理員)
輸入:
C:/nginx/nginx-service.exe install

 Server2016,Nginx,安裝配置 
6.2、卸載Nginx系統服務
按下Win+X+A鍵
打開命令提示符(管理員)
輸入:
C:/nginx/nginx-service.exe uninstall
Server2016,Nginx,安裝配置 
7、查看系統服務
7.1、進入服務

運行Win+R輸入:
services.msc
Server2016,Nginx,安裝配置
Server2016,Nginx,安裝配置
7.2、啟動Nginx服務
Server2016,Nginx,安裝配置
8、成功啟動之后,在IE瀏覽器中輸入:http://localhost/

Server2016,Nginx,安裝配置

9、用命令方式啟動、關閉Nginx服務
9.1、啟動Nginx服務
按下Win+X+A鍵
打開命令提示符(管理員)
輸入:net start nginx
Server2016,Nginx,安裝配置 
9.2、關閉Nginx服務
按下Win+X+A鍵
打開命令提示符(管理員)
輸入:net stop nginx
Server2016,Nginx,安裝配置 
10、Windows查看進程和殺死進程
10.1、查看Nginx進程號
tasklist | findstr 服務名
按下Win+X+A鍵
打開命令提示符(管理員)
輸入:
tasklist | findstr nginx
Server2016,Nginx,安裝配置 

10.2、使用tskill命令殺死進程(tskill PID)
Server2016,Nginx,安裝配置 
11、配置Nginx文件
Nginx配置文件目錄:
C:/nginx/conf
Server2016,Nginx,安裝配置 
11.1、編輯Nginx核心配置文件nginx.conf

# 根據你服務器的cpu核數來確定此值worker_processes 2;# events事件主要用來確定Nginx使用哪種算法events {  worker_connections 1024;} http {  #隱藏Nginx版本信息  server_tokens off;  include    mime.types;  default_type application/octet-stream;  sendfile    on;  keepalive_timeout 65;    #代理的相關參數設置  fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 128k; fastcgi_buffers 4 128k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k;  #啟用gzip壓縮,提高用戶訪問速度 gzip on; gzip_min_length 1k; gzip_buffers   4 32k; gzip_http_version 1.1; gzip_comp_level 2; gzip_types    text/plain application/x-javascript text/css application/xml; gzip_vary on; gzip_disable "MSIE [1-6].";  server_names_hash_bucket_size 128; client_max_body_size   100m;  client_header_buffer_size 256k; large_client_header_buffers 4 256k; #增加虛擬主機include vhosts.conf; }

 11.2、編輯Nginx虛擬主機配置文件vhosts.conf

 

#NGINX安裝初始化server {     listen   80;    charset utf-8;            server_name 127.0.0.1;    location / {        #打開瀏覽目錄        autoindex on;        #顯示出文件的大概大小        autoindex_exact_size off;        #顯示的文件時間為文件的服務器時間        autoindex_localtime on;    root  C:/wwwroot/html;    index index.html index.htm;    } }     

 12、創建網站根目錄
12.1、在C盤根目錄創建網站目錄,命名為"wwwroot"。
Server2016,Nginx,安裝配置 
12.2、在網站根目錄放入站點目錄,命名為"html"。
Server2016,Nginx,安裝配置 
12.3、瀏覽網頁
Server2016,Nginx,安裝配置

 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乌兰县| 开远市| 清徐县| 津市市| 固始县| 枝江市| 中宁县| 绥阳县| 璧山县| 武安市| 大新县| 苗栗县| 甘泉县| 吴桥县| 商河县| 栾川县| 海南省| 吴忠市| 南漳县| 廊坊市| 南涧| 益阳市| 抚松县| 寿宁县| 伊吾县| 太仓市| 资中县| 清徐县| 福鼎市| 禹城市| 镇康县| 莎车县| 台北县| 织金县| 满洲里市| 东至县| 玛曲县| 英山县| 定安县| 临沧市| 泽州县|