An Interest In:
Web News this Week
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
May 18, 2021 07:12 pm GMT
Original Link: https://dev.to/avi9360/how-to-configure-nginx-configuration-file-in-ubuntu-for-localhost-port-forwarding-1hlj
How to configure Nginx configuration file in ubuntu for localhost port forwarding
First
cd ..cd etc/nginx/
This takes you to the root dir of the Nginx server
then
cd sites-availablevim YourSiteName
Now,
server { listen 3000 default_server; listen [::]:3000 default_server; root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name _; location / { try_files $uri $uri/ =404; }}
To save and exit from the vim use this command
:wq
Now, We want to update the sites-enabled dir
cd ..cd sites-enabled/vim YourSiteName
server { listen 3000 default_server; listen [::]:3000 default_server; root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name _; location / { try_files $uri $uri/ =404; }}
Now, Rur your project/application and forward the port.
In the given example the defeat port is 3000.
cdcd yourProject npx http-server -p 3000
Check out more on in-depth guide through Nginx The Nginx is a reverse proxy that enables the user to host a static and dynamic website
Original Link: https://dev.to/avi9360/how-to-configure-nginx-configuration-file-in-ubuntu-for-localhost-port-forwarding-1hlj
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To