我們正試圖在Nandx上設置我們的Zandbox /測試站點上的Klaviyo。Nginx auth off整個文件夾
但是,當我啓用htpasswd時,Klaviyo無法從SOAP獲取數據。 它需要訪問www.mytestdomain.com/api/v2_soap?wsdl=1才能獲取數據。
如何禁用整個api文件夾的auth_basic?我已經做了一些PHP文件,但因爲這不是一個特定的PHP文件,我不知道。我使用的PHP文件中的代碼是:
location = /folder/file.php {
auth_basic off;
try_files $uri =404;
expires off;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
proxy_connect_timeout 2600s;
proxy_send_timeout 2600s;
proxy_read_timeout 2600s;
fastcgi_send_timeout 2600s;
fastcgi_read_timeout 2600s;
fastcgi_pass zandbox;
fastcgi_pass_request_headers on;
fastcgi_keep_conn off;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root${fastcgi_script_name};
fastcgi_param MAGE_RUN_CODE base;
fastcgi_param MAGE_RUN_TYPE website;
}
的完整代碼:
server {
listen 80;
server_name mydomain.dk www.mydomain.dk;
return 301 https://www.mydomain.dk$request_uri;
}
server {
listen 443 ssl;
server_name mydomain.dk;
ssl on;
ssl_certificate /etc/ssl/www_mydomain_dk.crt;
ssl_certificate_key /etc/ssl/www_mydomain_dk.key;
include /etc/nginx/ssl_common.conf;
return 301 https://www.mydomain.dk$request_uri;
}
server {
listen 443 ssl;
server_name www.mydomain.dk;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
location = /api/ {
auth_basic "off";
}
ssl on;
ssl_certificate /etc/ssl/www_mydomain_dk.crt;
ssl_certificate_key /etc/ssl/www_mydomain_dk.key;
include /etc/nginx/ssl_common.conf;
root /var/www/www.mydomain.dk/deployed/current;
add_header Access-Control-Allow-Origin "https://www.mydomain.dk";
add_header Access-Control-Allow-Origin "https://mydomain.dk";
include /etc/nginx/common.d/top_common.conf;
include /etc/nginx/common.d/locations.conf;
location ~ \.php$ {
try_files $uri =404;
expires off;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
proxy_connect_timeout 2600s;
proxy_send_timeout 2600s;
proxy_read_timeout 2600s;
fastcgi_send_timeout 2600s;
fastcgi_read_timeout 2600s;
fastcgi_pass mydomain;
fastcgi_pass_request_headers on;
fastcgi_keep_conn off;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root${fastcgi_script_name};
fastcgi_param MAGE_RUN_CODE base;
fastcgi_param MAGE_RUN_TYPE website;
}
location = /bridge_xcxcdd.php {
auth_basic off;
try_files $uri =404;
expires off;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
proxy_connect_timeout 2600s;
proxy_send_timeout 2600s;
proxy_read_timeout 2600s;
fastcgi_send_timeout 2600s;
fastcgi_read_timeout 2600s;
fastcgi_pass mydomain;
fastcgi_pass_request_headers on;
fastcgi_keep_conn off;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root${fastcgi_script_name};
fastcgi_param MAGE_RUN_CODE base;
fastcgi_param MAGE_RUN_TYPE website;
}
location = /api {
auth_basic off;
try_files $uri =404;
expires off;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
proxy_connect_timeout 2600s;
proxy_send_timeout 2600s;
proxy_read_timeout 2600s;
fastcgi_send_timeout 2600s;
fastcgi_read_timeout 2600s;
fastcgi_pass mydomain;
fastcgi_pass_request_headers on;
fastcgi_keep_conn off;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root${fastcgi_script_name};
fastcgi_param MAGE_RUN_CODE base;
fastcgi_param MAGE_RUN_TYPE website;
}
}
,你必須張貼完成配置試過。這不會。 –
當然。我已經添加完整的代碼現在:-) –