我已經在 apache 和 nginx 伺服器上嘗試過這個(分別,不是同時)。兩個預設伺服器都已正確向 IP 位址提供內容,但未向網域名稱「bt.dev」提供內容。這既適用於預設的「nginx/apache 伺服器已啟動並正在運行」狀態頁面,也適用於我嘗試在此處偵錯的 PicoCMS 安裝。
我使用過其他瀏覽器和其他設備,因此這不是客戶端快取問題。
這是我第一次設定這些伺服器,所以我可能遺漏了一些明顯的東西。
以下是一些狀態輸出:
pico.conf
/etc/nginx/sites-available/pico.conf
sites-enabled/
(當然符號連結到):
server {
listen 80;
server_name 195.201.89.229 b-t.dev;
root /var/www/html/pico;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php;
}
access_log /var/log/nginx/pico.access.log;
error_log /var/log/nginx/pico.error.log;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
}
Hetzner DNS 管理
Hetzner 已確認我的客戶端正在聯絡伺服器,如下所示這個問題表示可能有問題。
# ping b-t.dev
PING b-t.dev (195.201.89.229) 56(84) bytes of data.
64 bytes from static.229.89.201.195.clients.your-server.de (195.201.89.229): icmp_seq=1 ttl=58 time=0.503 ms
防火牆狀態:$ sudo ufw status 狀態:活動
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
mosh ALLOW Anywhere
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
Apache ALLOW Anywhere
Nginx HTTP ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
mosh (v6) ALLOW Anywhere (v6)
22/tcp (v6) ALLOW Anywhere (v6)
80/tcp (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
Apache (v6) ALLOW Anywhere (v6)
Nginx HTTP (v6) ALLOW Anywhere (v6)
系統控制狀態
$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) since Thu 2020-12-03 22:16:00 CST; 17h ago
Docs: man:nginx(8)
Process: 5060 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 5069 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 5074 (nginx)
Tasks: 2 (limit: 2286)
Memory: 3.0M
CGroup: /system.slice/nginx.service
├─5074 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
└─5075 nginx: worker process
看起來我可以簡單地設定從 IP 位址到網域的重定向,但這似乎是一個創可貼解決方案,不是嗎?