Jump to content
View in the app

A better way to browse. Learn more.

PHP论坛人

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

3.安裝Nginx,之後申請SSL憑證 / 更改主機名

Featured Replies

---------------------------------
安裝Nginx,之後申請SSL憑證
---------------------------------

apt update


apt upgrade -y


apt dist-upgrade -y


apt install curl vim wget gnupg dpkg apt-transport-https lsb-release ca-certificates


增加GPG Key
curl -sSL https://n.wtf/public.key | gpg --dearmor > /usr/share/keyrings/n.wtf.gpg

 

加入Nginx QUIC 源
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/n.wtf.gpg] https://mirror-cdn.xtom.com/sb/nginx/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/n.wtf.list

 


更新並安裝nginx
apt update


apt install nginx-extras -y

 


瀏覽nginx版本
nginx -V

 

將顯示 nginx version: nginx-n.wtf/1.25.4

 

 

 

----------------------------
更改主機名
----------------------------

更改主機名
hostnamectl set-hostname 域名.com


重開機
reboot


再次SSH登入

將顯示 Linux 域名.com 6.1.0-21-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.90-1 (2024-05-03) x86_64

 

 

----------------------------
配置Nginx
----------------------------

預設網站目錄
mkdir -p /var/www/域名.com

 

新增一個 域名.com.conf
vi /etc/nginx/sites-available/域名.com.conf

 

server {
        listen 80;

        root /var/www/域名.com;
        index index.html index.htm index.php;

        server_name 域名;

        location / {
                try_files $uri $uri/ =404;
        }
}


ESC儲存並離開
:wq

 


軟連結到 /etc/nginx/sites-enabled 目錄,讓它生效
ln -s /etc/nginx/sites-available/域名.com.conf /etc/nginx/sites-enabled/域名.com.conf

 


重新加载Nginx
nginx -t


nginx -s reload

 


在網站目錄中,新增一個index.html
vi /var/www/域名.com/index.html


在此檔案中,複製貼上
Just test

 

ESC儲存並離開
:wq

 

開機啟動nginx
systemctl enable nginx


啟動nginx
systemctl start nginx


重開機
reboot

 

瀏覽nginx狀態
systemctl status nginx

 

按 ctrl + z 停止

 

 

這時,瀏覽器可進入你的網站
http://域名.com/

 

接下來申請SSL憑證

 

Edited by Jack

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.