-
Notifications
You must be signed in to change notification settings - Fork 0
NGINX Web Server windows installation
SunilOS edited this page Mar 5, 2023
·
4 revisions
- Download the latest stable version of Nginx from the official website https://nginx.org/en/download.html. Choose the Windows version and download the zip file.
- Extract the contents of the zip file to a directory on your system, for example, C:\nginx.
- Open a Command Prompt window as an administrator.
- Navigate to the Nginx directory using the command: cd C:\nginx
- Run the command: nginx.exe to start Nginx.
- Open a web browser and navigate to http://localhost. If Nginx is running correctly, you will see the Nginx welcome page.
- To stop Nginx, open a Command Prompt window as an administrator and navigate to the Nginx directory. Run the command: nginx.exe -s stop That's it! You have successfully installed Nginx on Windows. You can now use it as a web server or a reverse proxy.
nginx/Windows runs as a standard console application (not a service), and it can be managed using the following commands:
- start nginx | start a server
- nginx -s stop | fast shutdown
- nginx -s quit | graceful shutdown
- nginx -s reload | changing configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes
- nginx -s reopen | re-opening log files
In Nginx, you can redirect traffic from one port to another port using the proxy_pass directive in your configuration file /conf/nginx.conf. The proxy_pass directive tells Nginx to forward requests to another server or port.
Here's an example of how to redirect traffic from port 80 to 9095 and 9097 ports:
server {
`listen 80;`
`server_name localhost;`
`location /SSOAPI {`
`proxy_pass http://localhost:9095/NCSSSO;`
`}`
`location /DOCAPI {`
`proxy_pass http://localhost:9097/NCSDOCS;`
`}`
}
- http://localhost/SSOAPI will redirect to http://localhost:9095/NCSSSO
- http://localhost/DOCAPI will redirect to http://localhost:9097/NCSDOCS