使用Docker,我目前有2个容器-nginx和PHP 7.0 php-fpm。
我现在需要针对PHP 7.2上的新代码进行扩展。
我添加了新的virtualenv venv
venv\Scripts\activate
pip install superset
条目。
upstream
此服务的当前配置为:
upstream php-70 {
server php-70:9000;
}
upstream php-72 {
server php-72:9000;
}
我现在需要的是以# By default rewrite all other requests to index.php
location / {
# Allows the Client to send cookies in CORS requests
add_header "Access-Control-Allow-Credentials" "true" always;
# Headers the Server can read from the Client in CORS requests
add_header "Access-Control-Allow-Headers" "Accept, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Headers, Authorization, Content-Type, Origin, X-Requested-With" always;
# Headers the Client can read from the Server in CORS requests
add_header "Access-Control-Expose-Headers" "Link" always;
# What requests methods can be used in a CORS request
add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, PUT, PATCH, DELETE" always;
# What origins (domains) can make CORS requests
add_header "Access-Control-Allow-Origin" "*" always;
rewrite .+ /index.php?$args?;
}
location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
expires off; ## Do not cache dynamic content
fastcgi_pass php-70;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS $https if_not_empty;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
# Allows the Client to send cookies in CORS requests
add_header "Access-Control-Allow-Credentials" "true" always;
# Headers the Server can read from the Client in CORS requests
add_header "Access-Control-Allow-Headers" "Accept, Access-Control-Request-Method, Access-Control-Request-Headers, Access-Control-Allow-Headers, Authorization, Content-Type, Origin, X-Requested-With" always;
# Headers the Client can read from the Server in CORS requests
add_header "Access-Control-Expose-Headers" "Link" always;
# What requests methods can be used in a CORS request
add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, PUT, PATCH, DELETE" always;
# What origins (domains) can make CORS requests
add_header "Access-Control-Allow-Origin" "$http_origin" always;
}
,/v0/
或/v1/
开头的URL,以转到php-70,如果URL以/v2/
开头,然后他们去了php-72。
配置是提供给我们的,我们不是nginx的专家,因此,如果对此做任何更明智的选择,那就更好了。