Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Windows Server 2016 Nginx installation and configuration detailed graphic text tutorial

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1, Download Nginx

Official website address:

http://nginx.org/

Download Address:

http://nginx.org/en/download.html

Download Windows Service Wrapper

Official website address:

https://github.com/kohsuke/winsw/

Download Address:

http://repo.jenkins-ci.org/releases/com/sun/winsw/winsw/

3. Extract the Nginx compressed package file to the C package directory and rename it to nginx

4. Rename "winsw-1.19-bin.exe" to "nginx-service.exe" and copy to the nginx root directory

5. Write nginx-service.xml file in nginx root directory

nginx-service.xml file contents

Nginx This service is used to load Nginx services. Please make sure to boot. C:\nginx\logs nginx.exe nginx.exe -s stop rotate

6, Install or uninstall Nginx system services

6.1 Install Nginx System Services

Press Win+X+A

Open Command Prompt (Administrator)

Input:

C:\nginx\nginx-service.exe install

6.2 Uninstall Nginx System Services

Press Win+X+A

Open Command Prompt (Administrator)

Input:

C:\nginx\nginx-service.exe uninstall

7. View system services

7.1 Access to services

Run Win+R Enter: services.msc 7.2 Start the Nginx service 8. After successful startup, enter http://localhost/in IE browser.

9, Start and close Nginx service by command

9.1 Start Nginx

Press Win+X+A

Open Command Prompt (Administrator)

Input: net start nginx

9.2 Nginx

Press Win+X+A

Open Command Prompt (Administrator)

Input: net stop nginx

Windows View Process and Kill Process

10.1 View Nginx Process Number

tasklist |findstr service name

Press Win+X+A

Open Command Prompt (Administrator)

Input:

tasklist | findstr nginx

10.2 kill process using tskill command (tskill PID)

11, Configure Nginx file

Nginx configuration file directory:

C:\nginx\conf

11.1 Edit Nginx Core Configuration File nginx.conf

#Determine this value based on the CPU kernel count of your server worker_processes 2;# events events are mainly used to determine which algorithm Nginx uses events { worker_connections 1024;} http { #Hide Nginx version information server_tokens off; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; #Proxy related parameter settings 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; #Enable gzip compression to improve user access speed 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; #add virtual hosts include vhosts.conf; }

11.2 Edit the Nginx virtual host configuration file vhosts.conf

#NGINX install initialization server { listen 80; charset utf-8; server_name 127.0.0.1; location / { #Open Browse Directory autoindex on; #Show approximate file size autoindex_exact_size off; #The file time displayed is the server time of the file autoindex_localtime on; root C:\wwwroot\html; index index.html index.htm; } }

12. Create a website root directory

12.1 Create a website directory in the C package directory and name it "wwwroot".

12.2 Put the site directory in the root directory of the website and name it "html".

12.3, browse web pages

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report