跳转到帖子
在手机APP中查看

一个更好的浏览方法。了解更多

PHP论坛人

主屏幕上的全屏APP,带有推送通知、徽章等。

在iOS和iPadOS上安装此APP
  1. 在Safari中轻敲分享图标
  2. 滚动菜单并轻敲添加到主屏幕
  3. 轻敲右上角的添加按钮。
在安卓上安装此APP
  1. 轻敲浏览器右上角的三个点菜单 (⋮) 。
  2. 轻敲添加到主屏幕安装APP
  3. 轻敲安装进行确认。

安裝第三方Nginx 1.29、更改主機名

精选回复

安裝第三方Nginx 1.29、更改主機名

---------------
安裝Nginx
---------------

本教學適用於 Debian 13 (需root權限),假設系統尚未安裝Nginx

此來源 https://n.wtf/ 提供第三方 Nginx(目前為 1.29.x),若想使用 Debian 官方版本可略過此步

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



加入 https://n.wtf/ 的Nginx源
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



apt update


apt install zip unzip


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


安裝nginx
apt install nginx-extras -y




瀏覽nginx版本,顯示 nginx version: nginx-n.wtf/1.29.4
nginx -V





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

更改主機名,修改 hostname 可能影響提示字元或部分服務,非必要可略過
hostnamectl set-hostname 域名.com


離開SSH
exit


再次SSH登入

將顯示為 Linux 域名.com 6.12.63+deb13-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.63-1 (2025-12-30) 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;

        server_name 域名.com;

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



ESC儲存並離開
:wq




若 /etc/nginx/sites-enabled/ 已存在其他網站,請先確認不衝突

軟連結到 /etc/nginx/sites-enabled 目錄,讓它生效


ln -s /etc/nginx/sites-available/域名.com.conf /etc/nginx/sites-enabled/域名.com.conf




重新載入Nginx
nginx -t

systemctl reload nginx







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


在此檔案中,複製並貼上

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>TEST</title>
</head>
<body>
TEST
</body>
</html>




ESC儲存並離開
:wq




----------------------------------
開機啟動Nginx
----------------------------------

開機啟動
systemctl enable nginx



啟動
systemctl start nginx



重開機
reboot



確認開機有自動啟動nginx,顯示 Active: active (running)
systemctl status nginx





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

创建帐户或登录后发表意见

帐户

导航

搜索

配置浏览器推送通知

Chrome (安卓)
  1. 轻敲地址栏旁的锁形图标。
  2. 轻敲权限 → 通知。
  3. 调整你的偏好。
Chrome (台式电脑)
  1. 点击地址栏中的挂锁图标。
  2. 选择网站设置。
  3. 找到通知选项并调整你的偏好。