ฉันกำลังพยายามติดตั้ง ย็อตเตอร์ บนเซิร์ฟเวอร์ของฉัน และฉันต้องการใช้ apache แทน nginx เดอะ คู่มือการติดตั้ง แสดงเฉพาะไฟล์การกำหนดค่า nginx ซึ่งฉันพยายาม "แปล"
การกำหนดค่าคือเส้นทางพร็อกซีที่แตกต่างกันสามเส้นทาง เส้นทางแรกนำไปสู่คอนเทนเนอร์นักเทียบท่า เส้นทางที่สอง (/คงที่/) ไปยังไดเร็กทอรีที่มีสไตล์ชีตและอะไรทำนองนั้น และอันสุดท้ายไปยังซ็อกเก็ตโดเมนยูนิกซ์
ในกรณีของฉัน เส้นทางแรกดูเหมือนจะใช้งานได้ (ฉันสามารถเข้าถึงไซต์ได้) แต่แต่ละคำขอที่ส่งไปยังแหล่งข้อมูลแบบสแตติกจะส่งคืน 404 ดูเหมือนว่าแต่ละคำขอจะใช้คำสั่งนักเทียบท่า ProxyPass (ไม่ว่าจะเรียงลำดับอย่างไร: ถ้าฉันใส่อันนั้น สุดท้าย (ดูด้านล่าง) ก็ยังใช้อยู่อันเดียว)
นี่คือ (ส่วนหนึ่งของ) ไฟล์บันทึกที่สร้างขึ้น:
yotter.domain.tld - - [12/Aug/2021:21:14:21 +0200] "GET /static/favicons/favicon.ico HTTP/1.1" 404 1935 file=proxy:http://127.0.0.1: 5000/static/favicons/favicon.ico
yotter.domain.tld - - [12/Aug/2021:21:15:54 +0200] "GET /index HTTP/1.1" 200 1126 file=proxy:http://127.0.0.1:5000/index
yotter.domain.tld - - [12/ส.ค./2021:21:15:54 +0200] "GET /static/semantic/semantic.min.css HTTP/1.1" 404 1935 file=proxy:http://127.0 0.1:5000/static/semantic/semantic.min.css
อะไรคือสาเหตุของสิ่งนี้
นี่คือการกำหนดค่า nginx:
เซิร์ฟเวอร์ {
ฟัง 80;
ชื่อเซิร์ฟเวอร์ <example.com>; # เปลี่ยนฉัน
access_log off;
ที่ตั้ง / {
proxy_pass http://127.0.0.1:5000;
proxy_http_version 1.1;
การเชื่อมต่อ proxy_set_header "";
}
ตำแหน่ง / คงที่ / {
รูท /home/ubuntu/Yotter/app/; # เปลี่ยนสิ่งนี้ขึ้นอยู่กับว่าคุณโคลน Yotter ที่ไหน
ส่งไฟล์บน;
เธรด aio=ค่าเริ่มต้น;
}
สถานที่ ~ (^/videoplayback$|/videoplayback/|/vi/|/a/) {
proxy_pass http://unix:/var/run/ytproxy/http-proxy.sock;
add_header Access-Control-Allow-Origin *;
ส่งไฟล์บน;
tcp_nopush บน;
aio_write บน;
เธรด aio=ค่าเริ่มต้น;
ทิศทาง 512;
proxy_http_version 1.1;
การเชื่อมต่อ proxy_set_header "";
}
}
และนี่คือสิ่งที่ฉันมีจนถึงตอนนี้:
<VirtualHost *:443>
ServerName yotter.domain.tld
LogFormat "%v %l %u %t \"%r\" %>s %b file=%f" commonvhost
CustomLog ${APACHE_LOG_DIR}/yotter_access.log commonvhost
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/domain.tld/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.tld/privkey.pem
<Location "/">
ProxyPass http://127.0.0.1:5000/
ProxyPassReverse http://127.0.0.1:5000/
</Location>
<Location "/static">
Alias "/var/www/Yotter/app/static"
</Location>
<Directory "/var/www/Yotter/app/">
Require all granted
</Directory>
<LocationMatch (^/videoplayback$|/videoplayback/|/vi/|/a/)>
ProxyPass unix:///var/run/ytproxy/http-proxy.sock
ProxyPassReverse unix:///var/run/ytproxy/http-proxy.sock
Header add Acces-Control-Allow-Origin: *
</LocationMatch>
</VirtualHost>
หรือ
<VirtualHost *:443>
ServerName yotter.domain.tld
LogFormat "%v %l %u %t \"%r\" %>s %b file=%f" commonvhost
CustomLog ${APACHE_LOG_DIR}/yotter_access.log commonvhost
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/domain.tld/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/domain.tld/privkey.pem
Alias "/static" "/var/www/Yotter/app/static"
<Directory "/var/www/Yotter/app/">
Require all granted
</Directory>
<LocationMatch (^/videoplayback$|/videoplayback/|/vi/|/a/)>
ProxyPass unix:///var/run/ytproxy/http-proxy.sock
ProxyPassReverse unix:///var/run/ytproxy/http-proxy.sock
Header add Acces-Control-Allow-Origin: *
</LocationMatch>
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
</VirtualHost>