ถ้าฉันเข้าชมเว็บไซต์ nginx ของฉันด้วย https มันใช้งานได้ แต่ด้วย http มันกำลังดาวน์โหลดไฟล์ชื่อ "ดาวน์โหลด" (ไม่มีส่วนขยายใด ๆ ), 57 ไบต์และเปิดด้วย notepad เป็นต้นเพียงแค่แสดงสิ่งที่พูดพล่อยๆ
นี่คือ vhost config ของฉัน:
server {
server_name www.domain.com domain.com;
listen 80;
return 301 https://domain.com$request_uri;
}
server {
server_name www.domain.com
listen 443 ssl;
/* SSL Stuff */
return 301 https://domain.com$request_uri;
}
server {
server_name domain.com;
index index.php index.html index.htm;
listen 443 ssl;
root /usr/share/nginx/domain.com;
/* SSL Stuff */
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\. {
deny all;
}
}
ขด-V:
curl -v http:/domain.com *
Rebuilt URL to: http://domain.com/ *
Hostname was NOT found in DNS cache *
Trying 175.*.*.*... *
Connected to domain.com (175.*:*:*) port 80 (#0)
> GET / HTTP/1.1 > User-Agent: curl/7.38.0
> Host: domain.com > Accept: */*
> * Connection #0 to host domain.com left intact
▒▒
การกำหนดค่านี้ก็โอเค ตรวจสอบว่าคุณได้ปรับ nginx ไฟร์วอลล์ที่ตั้งค่าไว้หรืออย่างอื่น
—
Alexey Ten
ตรวจสอบกับ
—
Alexey Ten
curl -v http://domain.com
ขอบคุณสำหรับการตอบกลับ ฉันรีสตาร์ทหลายครั้ง (ฉันลองเปลี่ยนบางส่วนของการกำหนดค่า แต่ไม่มีอะไรช่วย) ไฟร์วอลล์ของฉันก็โอเคเช่นกัน เมื่อตรวจสอบด้วย curl ฉันได้รับการตอบกลับที่แปลกประหลาด: ▒▒แค่นี้ - ไม่แสดงซอร์สโค้ดเหมือนที่ใช้กับ https
—
rzmpl
phpfpm ควรขึ้นและทำงานและซ็อกเก็ตควรมีอยู่ใน /run/php/php7.0-fpm.sock
—
Farhan
มันทำ PHP ทำงานได้ - ฉันไม่คิดว่ามันเป็นปัญหาของ PHP ทุกอย่างใน HTTPS ทำงานได้ไม่ว่าจะเป็น php หรือไม่ก็ตาม แต่ถ้าฉันพิมพ์ http: // หรือเพียงแค่โดเมน (ซึ่งในกรณีนี้ควรเปลี่ยนเส้นทางไปยัง https) เพียงแค่ดาวน์โหลดไฟล์ขนาดเล็ก 57 ไบต์ที่เรียกว่า "ดาวน์โหลด" - ข้อผิดพลาด Nginx ไม่แสดงอะไรเลย
—
rzmpl