:::

8. 安裝Nginx(非必須)

  1. 安裝
    apt install nginx

     

  2. 觀看狀態
    systemctl status nginx

     

  3. 若有 nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument 的錯誤
    mkdir /etc/systemd/system/nginx.service.d
    printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > /etc/systemd/system/nginx.service.d/override.conf
    systemctl daemon-reload
    systemctl restart nginx 

     

  4. 手動啟動
    systemctl start nginx

     

  5. 自動啟動
    systemctl enable nginx

     

  6. 查看版本
    nginx -v

     

  7. 檢查設定是否正確
    nginx -t

     

  8. 在網頁目錄建立預設網頁:
    vi /var/www/html/index.html

     

  9. index.html的內容為
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <body>
        網頁已開通!
    </body>
    </html>

     

  10. 可開啟瀏覽器,輸入IP,試試是否OK。
    http://網址或IP/

     


:::

書籍目錄

展開 | 闔起

http%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1545

計數器

今天: 836836836
昨天: 2798279827982798
總計: 3622467362246736224673622467362246736224673622467