[英]How do i configure a QGIS Server on an NGINX powered web server that is already serving a Laravel App
我已經在 Ubuntu 機器上成功設置了 QGIS 服務器。
我想訪問 url 上的一些地圖說: 121.123.124.124/qgisserver
我目前正在通過121.123.124.124/
訪問我的 laravel 應用程序
我已經為 qgisserver 配置了虛擬主機,如下所示:
server {
listen 80;
server_name 121.123.124.124;
location = /qgisserver {
gzip off;
include fastcgi_params;
fastcgi_pass unix:/var/run/qgisserver.socket;
}
}
laravel 應用程序主機文件如下所示:
server { listen 80; server_name 121.123.124.124; root /var/www/html/laravel-app/public; add_header X-Frame-Options "SAMEORIGIN"; add_header X-XSS-Protection "1; mode=block"; add_header X-Content-Type-Options "nosniff"; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } error_page 404 /index.php; 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; } location ~ /\.(?!well-known).* { deny all; } }
我通過在啟用站點的文件夾中符號鏈接並重新啟動 nginx 服務來啟用 qgisserver 虛擬主機。
但是,當我訪問121.123.124.124/qgisserver
時,它會返回默認的 laravel 404 錯誤頁面。
如何通過121.123.124.124/qgisserver
位置成功訪問我的 qgis 地圖,並且仍然可以在121.123.124.124/
訪問應用程序
謝謝你。
您不應該為此使用單獨的服務器塊,尤其是使用相同的服務器名稱! 您應該已經收到一條 nginx 消息,例如nginx: [warn] conflicting server name "121.123.124.124" on 0.0.0.0:80, ignored
; 它不是警告你你做錯了什么嗎? 將該位置放入提供 laravel 應用程序的同一服務器塊中。 要防止 QGIS 服務器 URL 以任何方式干擾您的 laravel 應用程序,請使用^~
位置修飾符:
location ^~ /qgisserver {
gzip off;
include fastcgi_params;
fastcgi_pass unix:/var/run/qgisserver.socket;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.