Nginx tutorial: Install nginx on linux ubuntu 23.04

To install Nginx on Ubuntu 22.04, follow these steps:

  1. Update system packages:

    sudo apt update
    ```
    
    
  2. Install Nginx:

    sudo apt install nginx
    ```
    
    在安装过程中,系统会提示你确认安装。按下"Y"继续安装。
    
    
  3. After the installation is complete, the Nginx service will start automatically. You can check the status of the Nginx service using the following command:

    sudo systemctl status nginx
    ```
    
    如果服务正在运行,你将看到类似以下内容的输出:
    

    ● nginx.service - A high-performance web server and a reverse proxy server
    Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
    Active: active (running)…

    
    
  4. Configure firewall (if required):
    If your system has a firewall enabled (such as ufw), you may need to configure the firewall to allow HTTP (port 80) and HTTPS (port 443) traffic. You can enable the corresponding firewall rules using the following command:

    sudo ufw allow 'Nginx Full'
    ```
    
    这将允许HTTP和HTTPS流量通过防火墙。
    
    
  5. Once completed, you can access Nginx’s default welcome page by entering your server’s IP address or domain name into your web browser. For example, if the server's IP address is 192.168.0.100, you can enter it in your browser http://192.168.0.100to access the page.

Now, you have successfully installed Nginx on Ubuntu 22.04. You can configure it as needed and use Nginx as a web server or reverse proxy server to host and manage your website.

Guess you like

Origin blog.csdn.net/a772304419/article/details/133500097