LogoLogo
DownloadBlog
  • Overview
  • Getting started
    • Meshnet explained
    • How to start using Meshnet
      • Using Meshnet on Windows
      • Using Meshnet on Android
      • Using Meshnet on iPhone/iPad
      • Using Meshnet on macOS
      • Using Meshnet on Linux
      • Using Meshnet on Android TV
    • How to use Meshnet securely
  • Features
    • Linking devices in Meshnet
      • Linking external Meshnet devices on Windows
      • Linking external Meshnet devices on Android
      • Linking external Meshnet devices on iPhone/iPad
      • Linking external Meshnet devices on macOS
      • Linking external Meshnet devices on Linux
      • Linking external Meshnet devices on Android TV
    • Explaining permissions
      • Remote access permissions
      • File sharing permissions
      • Traffic routing permissions
      • Local network permissions
    • Renaming devices in Meshnet
      • Renaming devices on Windows
      • Renaming devices on Android
      • Renaming devices on iPhone/iPad
      • Renaming devices on macOS
      • Renaming devices on Linux
    • Sharing files in Meshnet
      • Sharing files on Windows
      • Sharing files on Android
      • Sharing files on iPhone/iPad
      • Sharing files on macOS
      • Sharing files on Linux
      • Sharing files on Android TV
    • Routing traffic in Meshnet
      • Routing traffic from Windows
      • Routing traffic from Android
      • Routing traffic from iPhone/iPad
      • Routing traffic from macOS
      • Routing traffic from Linux
      • Routing traffic from Android TV
  • How-to guides
    • Gaming
      • How to set up a private Minecraft server with Meshnet
      • How to set up a private Stardew Valley server with Meshnet
      • How to play Quake 3 Arena over Meshnet
      • How to set up a private Team Fortress 2 server with Meshnet
      • How to set up a remote game-streaming server for Moonlight
      • How to set up a Palworld dedicated server
      • How to play Fallout: New Vegas multiplayer over Meshnet
      • How to set up a private Factorio server with Meshnet
    • Remote files and media access
      • How to set up and access shared folders
        • Configure and access shared folders on Windows
        • Configure and access shared folders on macOS
        • Configure and access shared folders on Linux
        • Access shared folders from Android
        • Access shared folders from iPhone/iPad
        • Access shared folders from Android TV
      • How to watch videos over Meshnet using Kodi
      • How to configure and access a Jellyfin media server remotely
      • How to set up a Plex media server and access it remotely
      • How to set up a remote NAS using OpenMediaVault and Meshnet
      • How to set up a remote picture library with LibrePhotos and Meshnet
      • How to use Syncthing for remote continuous file synchronization
      • How to set up a remote Airsonic music server
      • How to set up HTTP File Server for remote file access
      • How to set up a remote audiobook server
      • How to host a remote Kavita e-book server
      • How to set up and remotely access Immich using Meshnet
    • Remote device access
      • How to log in to your PC remotely over Meshnet
        • Connect to a Windows device
        • Connect to a macOS device
        • Connect to a Linux device
      • How to access remote systems over Meshnet using SSH
      • How to access your IP camera over Meshnet
      • How to use Home Assistant remotely over Meshnet
      • How to make secure macOS Time Machine backups from anywhere
      • How to use Ansible over Meshnet
      • How to access files in your NAS from anywhere without compromising its security
      • How to set up a phone as a security camera with remote access
      • How to assign custom host names to Meshnet services using Nginx proxy manager
      • How to use Proxmox VE remotely over Meshnet
      • How to set up a remotely controlled 3D printer
      • How to set up and remotely access a CasaOS server
    • Joint projects
      • How to set up an NGINX web server and remotely access it over Meshnet
      • How to use Nextcloud file syncing with Meshnet
      • How to set up pair programming using tmux
      • How to set up a Visual Studio Code server for remote development over Meshnet
      • How to host a Focalboard server for remote project management
      • How to use Meshnet for multi-screen Node.js development
      • How to use the Multi-user editing plugin in Unreal Engine over Meshnet
      • How to set up a private Mumble voice chat server
      • How to host a private Rocket.Chat server
    • Own VPN server setup
      • How to set up a VPN server through self-hosting or with DigitalOcean
      • How to create a VPN server with Microsoft Azure
      • How to create a VPN server with AWS
      • How to create a VPN server with Google Cloud
      • How to create a VPN server with Linode
      • How to create a VPN server with Hetzner
    • Network protection
      • How to set up your network protection with Pi-hole
      • How to set up your own DNS server
      • How to protect your network with AdGuard Home
      • How to use the self-hosted Whoogle search engine remotely
      • How to set up a VPN router using Meshnet
  • Troubleshooting
    • Common issues on Windows
    • Common issues on Android
    • Common issues on iPhone/iPad
    • Common issues on macOS
    • Common issues on Linux
Powered by GitBook

© 2025 Nord Security. All Rights Reserved.

On this page
  • Introduction
  • Configure a web server
  • Access the web server using Meshnet

Was this helpful?

  1. How-to guides
  2. Joint projects

How to set up an NGINX web server and remotely access it over Meshnet

Learn how to configure an NGINX web server on Windows, macOS, and Linux and remotely access it using Meshnet.

PreviousJoint projectsNextHow to use Nextcloud file syncing with Meshnet

Last updated 8 months ago

Was this helpful?

Introduction

Owning a is a dream many people have. Self-hosting a website grants you complete control over its configuration during all development stages and enhances data privacy because the information does not leave your infrastructure.

A tool that is widely used for configuring web servers is . It is free, open-source software that allows you to build and self-host websites. It can also function as a . However, the drawback of such a setup is that, without poking holes in your firewall, the server can only be accessed from the same (LAN). Having a commonly used port exposed to the outside world is dangerous because it can be scanned and probed for vulnerabilities by attackers.

This is where comes to your aid. By using Meshnet, you can have a secure and encrypted tunnel from end devices to your web server without any custom configurations. The website can also be accessed by your friends or family, which you have as your .

Even though the NGINX web server can be run as a , this guide will focus on the standard setup process. You will learn how to configure a simple HTML web server and remotely access it from other devices using Meshnet.

Configure a web server

In this part of the article, you can find instructions on how to configure the NGINX web server.

Set up NGINX

To start setting up the web server, you will need to install NGINX.

  1. Go to the and download the latest mainline version for Windows.

  2. Extract the downloaded archive.

  3. Move the extracted folder to a convenient location — for example, the desktop.

  4. Go inside the NGINX folder, open the conf folder, and locate the nginx.conf file.

  5. Open the nginx.conf file using a text editor, such as Notepad.

  6. Locate the listen line and ensure that the number next to it is set to 80.

  7. Save changes (File > Save) and exit.

Note

For example, if the port is set to 8080, you would need to enter the following in your internet browser: localhost:8080

Control NGINX

You can control NGINX services by using the command line. Commands allow you to start, stop, and restart NGINX.

  1. Locate the nginx.exe file in the NGINX folder, right-click it, and choose Properties.

  2. Copy its full path, which is displayed next to Location.

  3. In the Command Prompt window, enter cd and paste in the copied path surrounded by quotation marks. Example

    cd "C:\Users\meshnet\Desktop\nginx-1.27.1\"

    Now, you can control the nginx.exe file using the Command Prompt.

  4. Type in nginx.exe and press Enter to start the web server. To check if the web server started, open an internet browser of your choice and enter localhost in the URL bar. If the setup is correct, you will be greeted with the default NGINX landing page.

Note

If the Windows security alert box appears, select both the private and public networks options, and then click the Allow access button to allow incoming connections through the firewall.

Note

You won't be able to run any other commands in the same Command Prompt that was used to start NGINX. To run any new NGINX-related commands, you should open a new command prompt window and navigate to the NGINX directory once again.

Personalize your landing page

You can make adjustments to the landing page to customize the website to your preference.

  1. In the NGINX folder, open the html folder and locate the index.html file.

  2. Open index.html using a text editor, such as Notepad.

  3. Make any necessary changes to the file using HTML.

  4. Save changes (File > Save) and exit.

  5. In the command prompt, run the following command to reload NGINX with the new configuration:

    nginx.exe -s reload

Lastly, visit localhost in your web browser once again to see the newly designed website.

Note

The initial iteration of the web server may still be visible in the browser after reloading the NGINX server. This is because it is saved in the browser’s cache.

Note

Homebrew is compatible with macOS Big Sur (Version 11) or later.

For this configuration, macOS Sonoma (Version 14.6.1) with an Intel processor was used.

Install Homebrew

  1. Open Terminal.

  2. Enter the following command:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3. Follow the on-screen instructions to finish the installation.

With Homebrew installed, you can proceed with installing NGINX.

Install NGINX

To install NGINX using Homebrew, follow these steps:

  1. Open Terminal and run the following command:

    brew install nginx

  2. Wait for Homebrew to download and install NGINX with all of the required dependencies.

Change the configuration file

By default, the NGINX port will be set to 8080. However, you can change it to port 80 to allow easier access to the web server via Meshnet.

To change the port number for the NGINX web server, do the following:

  1. Open the nginx.conf file using the Nano text editor by running this command in Terminal: For Intel Macs:

    nano /usr/local/etc/nginx/nginx.conf
    nano /opt/homebrew/etc/nginx/nginx.conf

  2. Locate the listen line and change the number next to it from 8080 to 80.

  3. Press Control + X, Y, and Return to save changes and exit.

  4. Run the following command to restart the NGINX service:

    brew services restart nginx

With the service restarted, open an internet browser of your choice and enter localhost in the URL bar. If the setup is successful, you will be greeted with the default NGINX landing page.

Note

If you do not change the port number to port 80, you will be required to specify the port from the nginx.conf file when accessing the website.

For example, if you leave the default port 8080, you would need to enter the following in your internet browser: localhost:8080

Personalize your landing page

Now you should have the web server up and running. You can make adjustments to the landing page to customize the website to your preference.

  1. Open Terminal and run the following command: For Intel Macs:

    nano /usr/local/var/www/index.html
    nano /opt/homebrew/var/www/index.html

  2. Make any necessary changes to the file using HTML.

  3. After modifying the file, press Control + X, Y, and Return to save changes and exit.

  4. Run the following command to restart the NGINX service:

    brew services restart nginx

    Enter your user password, if prompted.

Lastly, visit localhost in your web browser once again to see the newly designed website.

Note

The initial iteration of the web server may still be visible in the browser after reloading the NGINX server. This is because it is saved in the browser’s cache.

Note

For this configuration, Ubuntu 24.04.1 LTS was used.

Set up NGINX

To start setting up the web server, you need to install NGINX.

  1. Update all of your repositories and install NGINX by running the following command in Terminal:

    sudo apt update && sudo apt install nginx -y

  2. Once the installation finishes, run the following command to open the NGINX configuration file using the Nano text editor.

    sudo nano /etc/nginx/sites-available/default

    For other Linux distributions, use this command:

    sudo nano /etc/nginx/nginx.conf

  3. Locate the listen line and ensure that the number next to it is set to 80.

    If you do make any changes, press Ctrl + X, Y, and Enter to save and exit.

Now, open your internet browser and enter localhost into the URL bar. If the setup was correct, you will be greeted with the default NGINX landing page.

Note

For example, if the port is set to 8080, you would need to enter the following in your internet browser: localhost:8080

How to fix error 98

The most common error that you can encounter while trying to start NGINX is error 98. It may come with either of the following messages:

nginx: [emerg] bind() to failed (98: Address already in use)
nginx: [emerg] bind() to failed (98: Unknown error)

If you receive this error, you will not be able to finish the configuration without resolving it.

To fix the error, find what service is using the required port (for example, port 80) by running the following command:

sudo netstat -tulpn | grep :80

Note

The net-tools package is required to use the netstat command.

It can be installed by executing the following command:

sudo apt install net-tools

In the output, you will see the name of the process and its process identification number (PID). With that information, you can kill the process by using sudo kill <PID>.

Example

sudo kill 2059

Alternatively, you can either change the port of NGINX or the port of the other service.

Personalize your landing page

Now you should have the web server up and running. You can make adjustments to the landing page to customize the website to your preference.

  1. Open the index.nginx-debian.html file using the Nano text editor by running this command:

    sudo nano /var/www/html/index.nginx-debian.html

    If you do not have the index.nginx-debian.html file, use the following command to find the necessary .html file on your system.

    ls /var/www/html

  2. Make any necessary changes to the file using HTML.

  3. After modifying the file, press Ctrl + X, Y, and Enter to save changes and exit.

  4. If NGINX is still running, run the following command to restart it with the new change:

    sudo nginx -s reload

    Otherwise, you can start NGINX by running the sudo nginx command.

Lastly, visit localhost in your web browser once again to see the newly designed website.

Note

The initial iteration of the web server may still be visible in the browser after reloading the NGINX server. This is because it is saved in the browser’s cache.

Access the web server using Meshnet

Once the web server is up and running, you can reach it remotely via Meshnet from your peer devices.

  1. Copy the NGINX server device's Nord name from the NordVPN application.

  2. Open your internet browser.

  3. Paste the copied Nord name followed by a slash (/) to the URL field and press Enter. Example

If you do not change the to port 80, you will be required to specify the port from the nginx.conf file when accessing the website.

Open the Windows Command Prompt by pressing the Windows key + R on your keyboard, typing in cmd, and pressing Enter.

To resolve this problem, and try accessing the website once more.

To install NGINX, you can use the package manager. Install Homebrew by taking these steps:

For additional information about the installation process, refer to .

For :

For :

To resolve this problem, and try accessing the website once more.

If you do not change the to port 80, you will be required to specify the port from the /etc/nginx/sites-available/default file when accessing the website.

To resolve this problem, and try accessing the website once more.

port number
clear your cache
Homebrew
Homebrew documentation
Apple silicon Macs
Apple silicon Macs
clear your cache
port number
clear your cache
personal web server
NGINX
reverse proxy
local area network
Meshnet
Meshnet peers
Docker container
NGINX download page
nginx.conf file highlighted in the NGINX folder.
nginx.conf file highlighted in the NGINX folder.
Section of the nginx.conf file containing the port number highlighted.
Full path of the NGINX folder highlighted.
NGINX landing page visible after visiting localhost on an internet browser.
NGINX landing page visible after visiting localhost on an internet browser.
Port 8080 highlighted in the NGINX installation output
Port 8080 highlighted in the NGINX installation output
nginx.conf file section indicating the port number.
nginx.conf file section indicating the port number.
NGINX landing page visible after visiting localhost on an internet browser.
NGINX landing page visible after visiting localhost on an internet browser.
Section of the default file indicating the port number used by NGINX.
NGINX landing page visible after visiting localhost on an internet browser.
NGINX landing page visible after visiting localhost on an internet browser.
Terminal output showing processes that are using port 80.
Custom NGINX website showing after entering the Nord name to the URL bar.
Custom NGINX website showing after entering the Nord name to the URL bar.