If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Nginx web server installation and configuration

Started by TJHarris, Dec 12, 2022, 03:04 AM

Previous topic - Next topic

TJHarrisTopic starter

What is required for creating a web server using Nginx on Ubuntu 18.04 LTS?
We will need a Virtual Machine (VM) for VMware installed on any computer, and the Desktop image of Ubuntu 18.04 LTS distribution for graphical shell support.



Before starting the installation process on the VM, we need to customize the hardware settings by increasing the processors value to 4 and install the OS and update it to the current version. To install the Nginx web server, we can use the command "apt-get install nginx" and check its status with "systemctl status nginx".

To view our "site", we can find out the local address of our virtual machine through the terminal and copy and paste it into the browser. After this step, we can edit the automatically generated HTML page in the /var/www/html/ directory using a text editor called Nano.

To make our site accessible to the world, we can use a free dynamic DNS service that provides us with a domain name for 30 days. Before doing so, we need to determine our internet connection and perform port mapping or forwarding if necessary.

To redirect traffic from port 8080 to port 80 and access the VM's IP address, we need to log in to the web interface of the router and add a forwarding rule. To do this, we should find the router's IP address and then locate the "Redirection" section.

Now, we need to visit noip.com and create a hostname by entering our chosen name and selecting a free domain. Then, we should enter either our PC or router's IPv4 address, depending on the type of connection, and wait for the update to take effect.

To complete the process, we can enter our newly created address, followed by ":8080", to ensure that everything is working. It is possible to deploy a web server on our own computer without using a virtual machine, but it's better to avoid cluttering our control center with test sites.
  •  


fallfro

The author expresses doubts about using VMware for hosting and questions the need for a virtual machine for security purposes. They argue that there are other options, such as Hyper-V on Windows, which already has Ubuntu installed, or using Nginx on Windows instead of Linux. Additionally, the author notes that some operators may not allow noip or dyndns services, making them unreliable.

However, it is important to note that using a virtual machine can provide added security and flexibility for hosting, especially for larger and more complex websites. Each hosting option has its own advantages and disadvantages, and the best one will depend on individual needs and preferences. It's important to weigh all options carefully before making a decision.
  •  

Deepak1

One option for virtual machines is to try Amazon's free tier, which offers 700 hours per month of ec2 instances. Another possibility is using Google Cloud with Terraform and Ansible, which can be easy to set up by following instructions and using pre-made roles. By using these services, deploying a new service can take as little as ten to twenty minutes. It's also important to note that using Terraform's "destroy" function can remove all instances and prevent further billing by Amazon, Azure, or Google.

Overall, it's worth exploring different virtual machine options available and finding the best fit for specific requirements. Both cloud-based and self-hosted solutions have their pros and cons, and it may take some experimentation to figure out what works best in each case.
  •  

Edric

The author argues that if there are issues with the internet or electricity, then a self-hosted project may be prone to going offline. They suggest that for projects that need to be constantly available, it is better to use paid hosting services to ensure reliable uptime.

While self-hosting may offer some flexibility and control, it's important to consider all factors, including potential downtime and maintenance costs. However, for smaller-scale projects or experimentation, using tools like Denwer may be sufficient. Ultimately, the choice of hosting options will depend on the specific needs and resources available.
  •  

sumoncps

Nginx is a popular web server software known for its high performance, scalability, and flexibility. Here are some additional details about Nginx installation and configuration:

1. Installation: To install Nginx on Ubuntu 18.04 LTS, you can use the following command in the terminal:
```
sudo apt-get update
sudo apt-get install nginx
```
This will update the package list and install the Nginx web server.

2. Configuration Files: After installation, Nginx configuration files are located in the `/etc/nginx` directory. The main configuration file is `nginx.conf`, but Nginx also includes a `sites-available` directory where you can create separate configuration files for individual websites.

3. Basic Configuration: The main configuration file, `nginx.conf`, contains global settings for Nginx. It includes directives like user, worker_processes, and events that control the behavior of the server.

4. Virtual Hosts: Nginx uses virtual hosts to serve multiple websites on a single server. Each virtual host has its own configuration file under the `sites-available` directory. To enable a virtual host, you need to create a symbolic link from the `sites-available` directory to the `sites-enabled` directory.

5. SSL/TLS Configuration: If you want to enable HTTPS for your website, you will need an SSL/TLS certificate. You can obtain a certificate from a trusted certificate authority or use Let's Encrypt, which provides free SSL certificates. Nginx has specific directives like listen, ssl_certificate, and ssl_certificate_key to configure SSL/TLS.

6. Server Blocks: Server blocks (also known as server sections or server contexts) allow you to define the settings for each website. Each server block usually contains a `server_name` directive to specify the domain name associated with the website.

7. Proxy Pass and Load Balancing: Nginx can also function as a reverse proxy server or load balancer. With the `proxy_pass` directive, you can redirect requests to different backend servers or distribute traffic across multiple servers for high availability and scalability.

Nginx provides extensive dоcumentation that covers various advanced features and options, so you can explore further depending on your specific requirements.
  •  

ichiro

You first need to grab the Desktop ISO for GUI support and allocate at least 4 vCPUs to keep things snappy. After installing and updating the OS, a quick apt-get install nginx gets your web stack ready. Check the service health with systemctl status nginx. Grab the VM's local IP to preview your site via browser, then tweak the default HTML in /var/www/html/ using Nano or your editor of choice.

For public access, dynamic DNS providers like noip.com offer a free hostname - just remember to map ports on your router, redirecting external port 8080 to internal port 80. This setup's solid for dev or lightweight hosting, but keep in mind latency and NAT traversal issues when exposing a VM behind a consumer router.
  •  

inhathanh

This is a clear and helpful guide for beginners setting up Nginx on Ubuntu 18.04. However, a few improvements would strengthen it:
– Consider using a more recent Ubuntu LTS version (e.g. 22.04).
– Mention basic firewall settings (ufw allow 'Nginx Full') to avoid access issues.
– The dynamic DNS part is useful, but adding info on No-IP client setup would make it more complete.
– Suggest configuring server blocks (virtual hosts) for better domain management.
– Finally, recommend using HTTPS (via Let's Encrypt) for security if exposing the site to the public.

Good starting point, but could benefit from updates and deeper technical insights.



If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...