pass in Rancherhttp://服务代号.命名空间:端口Implementation of Intranet Calling Each Container
1. In the new deployment plan, it is expected that the mutual calls between the containers on the server are no longer based on the domain name, but based on the service name. as shown in Figure 1
2. Existing plans. A service container contains 3 applications, and its ports are all configured as 80 , based on the domain name. call:https://ccpapi.dev.chinamcloud.cn. as shown in Figure 2
https://ccpauth.dev.chinamcloud.cn
https://ccpapi.dev.chinamcloud.cn
https://ccprpc.dev.chinamcloud.cn
3. Existing planning. A service container contains 3 applications, and its ports are all configured as 80 , based on the domain name. call:https://ccpauth.dev.chinamcloud.cn. as shown in Figure 3
4. Existing plans. The contents of the nginx configuration file in the container are as follows
server {
listen 80; ## listen for ipv4
server_name ccpauth.dev.chinamcloud.cn;
charset utf-8;
root /mcloud/www/channel-pub-api/frontend/web;
index index.php;
location / {
# 如果找不到真实存在的文件,把请求分发至 index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
# deny accessing php files for the /assets directory
location ~ ^/assets/.*\.php$ {
deny all;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~* /\. {
deny all;
}
}
server {
listen 80; ## listen for ipv4
server_name ccprpc.dev.chinamcloud.cn;
charset utf-8;
root /mcloud/www/channel-pub-api/rpc/web;
index index.php;
location / {
# 如果找不到真实存在的文件,把请求分发至 index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
# deny accessing php files for the /assets directory
location ~ ^/assets/.*\.php$ {
deny all;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~* /\. {
deny all;
}
}
server {
listen 80; ## listen for ipv4
server_name ccpapi.dev.chinamcloud.cn localhost;
charset utf-8;
root /mcloud/www/channel-pub-api;
index index.php;
location / {
root /mcloud/www/channel-pub-api/api/web;
try_files $uri $uri/ /api/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/assets/.+\.php(/|$) {
deny all;
}
}
location /customize {
alias /mcloud/www/channel-pub-api/customize/web/;
location = /customize {
try_files $uri /customize/customize/web/index.php$is_args$args;
}
try_files $uri $uri/ /customize/customize/web/index.php$is_args$args;
location ~ ^/customize/assets/.+\.php(/|$) {
deny all;
}
}
location /baijia {
alias /mcloud/www/channel-pub-api/baijia/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /baijia/ {
# return 301 /baijia;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /baijia {
# if your location is "/baijia", try use "/baijia/baijia/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /baijia/baijia/web/index.php$is_args$args;
}
# if your location is "/baijia", try use "/baijia/baijia/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /baijia/baijia/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/baijia/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/baijia/assets/.+\.php(/|$) {
deny all;
}
}
location /douyin {
alias /mcloud/www/channel-pub-api/douyin/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /douyin/ {
# return 301 /douyin;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /douyin {
# if your location is "/douyin", try use "/douyin/douyin/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /douyin/douyin/web/index.php$is_args$args;
}
# if your location is "/douyin", try use "/douyin/douyin/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /douyin/douyin/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/douyin/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/douyin/assets/.+\.php(/|$) {
deny all;
}
}
location /netease {
alias /mcloud/www/channel-pub-api/netease/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /netease/ {
# return 301 /netease;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /netease {
# if your location is "/netease", try use "/netease/netease/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /netease/netease/web/index.php$is_args$args;
}
# if your location is "/netease", try use "/netease/netease/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /netease/netease/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/netease/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/netease/assets/.+\.php(/|$) {
deny all;
}
}
location /qq {
alias /mcloud/www/channel-pub-api/qq/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /qq/ {
# return 301 /qq;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /qq {
# if your location is "/qq", try use "/qq/qq/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /qq/qq/web/index.php$is_args$args;
}
# if your location is "/qq", try use "/qq/qq/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /qq/qq/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/qq/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/qq/assets/.+\.php(/|$) {
deny all;
}
}
location /vtt {
alias /mcloud/www/channel-pub-api/vtt/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /vtt/ {
# return 301 /vtt;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /vtt {
# if your location is "/vtt", try use "/vtt/vtt/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /vtt/vtt/web/index.php$is_args$args;
}
# if your location is "/vtt", try use "/vtt/vtt/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /vtt/vtt/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/vtt/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/vtt/assets/.+\.php(/|$) {
deny all;
}
}
location /weibo {
alias /mcloud/www/channel-pub-api/weibo/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /weibo/ {
# return 301 /weibo;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /weibo {
# if your location is "/weibo", try use "/weibo/weibo/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /weibo/weibo/web/index.php$is_args$args;
}
# if your location is "/weibo", try use "/weibo/weibo/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /weibo/weibo/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/weibo/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/weibo/assets/.+\.php(/|$) {
deny all;
}
}
location /wx {
alias /mcloud/www/channel-pub-api/wx/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /wx/ {
# return 301 /wx;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /wx {
# if your location is "/wx", try use "/wx/wx/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /wx/wx/web/index.php$is_args$args;
}
# if your location is "/wx", try use "/wx/wx/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /wx/wx/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/wx/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/wx/assets/.+\.php(/|$) {
deny all;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ ^/.+\.php(/|$) {
rewrite (?!^/((api|customize|baijia|customize|douyin|netease|qq|vtt|weibo|wx)/web|baijia|customize|douyin|netease|qq|vtt|weibo|wx))^ /api/web$uri break;
rewrite (?!^/baijia/web)^/baijia(/.+)$ /baijia/web$1 break;
rewrite (?!^/customize/web)^/customize(/.+)$ /customize/web$1 break;
rewrite (?!^/douyin/web)^/douyin(/.+)$ /douyin/web$1 break;
rewrite (?!^/netease/web)^/netease(/.+)$ /netease/web$1 break;
rewrite (?!^/qq/web)^/qq(/.+)$ /qq/web$1 break;
rewrite (?!^/vtt/web)^/vtt(/.+)$ /vtt/web$1 break;
rewrite (?!^/weibo/web)^/weibo(/.+)$ /weibo/web$1 break;
rewrite (?!^/wx/web)^/wx(/.+)$ /wx/web$1 break;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
try_files $fastcgi_script_name =404;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\. {
deny all;
}
}
5. Existing planning. The rules for load balancing are all custom domain names. as shown in Figure 4
6. New planning. A service container contains 3 applications, and CCPAuth needs to support external network domain names, and there is no need to support intranet calls. CCPAPI and CCPRPC need to support intranet service name calls, no need to support external network calls. Its ports are configured as 80, 82, and 83 respectively, based on port differentiation.
https://ccpauth.dev.chinamcloud.cn
http://ccpapi.ccp:82
http://ccpapi.ccp:83
7. New planning. The contents of the nginx configuration file in the container are as follows
server {
listen 80; ## listen for ipv4
server_name ccpauth.dev.chinamcloud.cn;
charset utf-8;
root /mcloud/www/channel-pub-api/frontend/web;
index index.php;
location / {
# 如果找不到真实存在的文件,把请求分发至 index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
# deny accessing php files for the /assets directory
location ~ ^/assets/.*\.php$ {
deny all;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~* /\. {
deny all;
}
}
server {
listen 83; ## listen for ipv4
server_name ccpapi.ccp;
charset utf-8;
root /mcloud/www/channel-pub-api/rpc/web;
index index.php;
location / {
# 如果找不到真实存在的文件,把请求分发至 index.php
try_files $uri $uri/ /index.php$is_args$args;
}
# uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
# deny accessing php files for the /assets directory
location ~ ^/assets/.*\.php$ {
deny all;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~* /\. {
deny all;
}
}
server {
listen 82; ## listen for ipv4
server_name ccpapi.ccp localhost;
charset utf-8;
root /mcloud/www/channel-pub-api;
index index.php;
location / {
root /mcloud/www/channel-pub-api/api/web;
try_files $uri $uri/ /api/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/assets/.+\.php(/|$) {
deny all;
}
}
location /customize {
alias /mcloud/www/channel-pub-api/customize/web/;
location = /customize {
try_files $uri /customize/customize/web/index.php$is_args$args;
}
try_files $uri $uri/ /customize/customize/web/index.php$is_args$args;
location ~ ^/customize/assets/.+\.php(/|$) {
deny all;
}
}
location /baijia {
alias /mcloud/www/channel-pub-api/baijia/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /baijia/ {
# return 301 /baijia;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /baijia {
# if your location is "/baijia", try use "/baijia/baijia/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /baijia/baijia/web/index.php$is_args$args;
}
# if your location is "/baijia", try use "/baijia/baijia/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /baijia/baijia/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/baijia/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/baijia/assets/.+\.php(/|$) {
deny all;
}
}
location /douyin {
alias /mcloud/www/channel-pub-api/douyin/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /douyin/ {
# return 301 /douyin;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /douyin {
# if your location is "/douyin", try use "/douyin/douyin/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /douyin/douyin/web/index.php$is_args$args;
}
# if your location is "/douyin", try use "/douyin/douyin/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /douyin/douyin/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/douyin/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/douyin/assets/.+\.php(/|$) {
deny all;
}
}
location /netease {
alias /mcloud/www/channel-pub-api/netease/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /netease/ {
# return 301 /netease;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /netease {
# if your location is "/netease", try use "/netease/netease/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /netease/netease/web/index.php$is_args$args;
}
# if your location is "/netease", try use "/netease/netease/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /netease/netease/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/netease/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/netease/assets/.+\.php(/|$) {
deny all;
}
}
location /qq {
alias /mcloud/www/channel-pub-api/qq/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /qq/ {
# return 301 /qq;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /qq {
# if your location is "/qq", try use "/qq/qq/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /qq/qq/web/index.php$is_args$args;
}
# if your location is "/qq", try use "/qq/qq/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /qq/qq/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/qq/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/qq/assets/.+\.php(/|$) {
deny all;
}
}
location /vtt {
alias /mcloud/www/channel-pub-api/vtt/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /vtt/ {
# return 301 /vtt;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /vtt {
# if your location is "/vtt", try use "/vtt/vtt/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /vtt/vtt/web/index.php$is_args$args;
}
# if your location is "/vtt", try use "/vtt/vtt/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /vtt/vtt/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/vtt/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/vtt/assets/.+\.php(/|$) {
deny all;
}
}
location /weibo {
alias /mcloud/www/channel-pub-api/weibo/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /weibo/ {
# return 301 /weibo;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /weibo {
# if your location is "/weibo", try use "/weibo/weibo/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /weibo/weibo/web/index.php$is_args$args;
}
# if your location is "/weibo", try use "/weibo/weibo/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /weibo/weibo/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/weibo/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/weibo/assets/.+\.php(/|$) {
deny all;
}
}
location /wx {
alias /mcloud/www/channel-pub-api/wx/web/;
# redirect to the URL without a trailing slash (uncomment if necessary)
#location = /wx/ {
# return 301 /wx;
#}
# prevent the directory redirect to the URL with a trailing slash
location = /wx {
# if your location is "/wx", try use "/wx/wx/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri /wx/wx/web/index.php$is_args$args;
}
# if your location is "/wx", try use "/wx/wx/web/index.php$is_args$args"
# bug ticket: https://trac.nginx.org/nginx/ticket/97
try_files $uri $uri/ /wx/wx/web/index.php$is_args$args;
# omit static files logging, and if they don't exist, avoid processing by Yii (uncomment if necessary)
#location ~ ^/wx/.+\.(css|js|ico|png|jpe?g|gif|svg|ttf|mp4|mov|swf|pdf|zip|rar)$ {
# log_not_found off;
# access_log off;
# try_files $uri =404;
#}
location ~ ^/wx/assets/.+\.php(/|$) {
deny all;
}
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ ^/.+\.php(/|$) {
rewrite (?!^/((api|customize|baijia|customize|douyin|netease|qq|vtt|weibo|wx)/web|baijia|customize|douyin|netease|qq|vtt|weibo|wx))^ /api/web$uri break;
rewrite (?!^/baijia/web)^/baijia(/.+)$ /baijia/web$1 break;
rewrite (?!^/customize/web)^/customize(/.+)$ /customize/web$1 break;
rewrite (?!^/douyin/web)^/douyin(/.+)$ /douyin/web$1 break;
rewrite (?!^/netease/web)^/netease(/.+)$ /netease/web$1 break;
rewrite (?!^/qq/web)^/qq(/.+)$ /qq/web$1 break;
rewrite (?!^/vtt/web)^/vtt(/.+)$ /vtt/web$1 break;
rewrite (?!^/weibo/web)^/weibo(/.+)$ /weibo/web$1 break;
rewrite (?!^/wx/web)^/wx(/.+)$ /wx/web$1 break;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
try_files $fastcgi_script_name =404;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\. {
deny all;
}
}
8. New planning. View the rules for load balancing, leaving only ccpauth.dev.chinamcloud.cn. as shown in Figure 5
9. New planning. Invoke the addresses of 3 applications inside your own container, and the call is successful.
[root@ccpapi-78d6f74688-rfjhf /]# cd /mcloud/www/channel-pub-api/
[root@ccpapi-78d6f74688-rfjhf channel-pub-api]# cd api/web/
[root@ccpapi-78d6f74688-rfjhf web]# vi api.txt
[root@ccpapi-78d6f74688-rfjhf web]# cd ..
[root@ccpapi-78d6f74688-rfjhf api]# cd ..
[root@ccpapi-78d6f74688-rfjhf channel-pub-api]# cd qq/web/
[root@ccpapi-78d6f74688-rfjhf web]# vi qq.txt
[root@ccpapi-78d6f74688-rfjhf web]# cd rpc/web
bash: cd: rpc/web: No such file or directory
[root@ccpapi-78d6f74688-rfjhf web]# cd ..
[root@ccpapi-78d6f74688-rfjhf qq]# cd ..
[root@ccpapi-78d6f74688-rfjhf channel-pub-api]# cd rpc/web/
[root@ccpapi-78d6f74688-rfjhf web]# vi rpc.txt
[root@ccpapi-78d6f74688-rfjhf web]# cd ..
[root@ccpapi-78d6f74688-rfjhf rpc]# cd ..
[root@ccpapi-78d6f74688-rfjhf channel-pub-api]# cd frontend/web/
[root@ccpapi-78d6f74688-rfjhf web]# vi auth.txt
[root@ccpapi-78d6f74688-rfjhf web]# curl http://ccpapi.ccp:82/api.txt
api
[root@ccpapi-78d6f74688-rfjhf web]# curl http://ccpapi.ccp:82/qq/qq.txt
qq
[root@ccpapi-78d6f74688-rfjhf web]# curl http://ccpapi.ccp:83/rpc.txt
rpc
[root@ccpapi-78d6f74688-rfjhf web]# curl https://ccpauth.dev.chinamcloud.cn/auth.txt
auth
[root@ccpapi-78d6f74688-rfjhf web]#
10. New planning. Invoke the addresses of 3 applications inside other containers, and the call is successful. as shown in Figure 6
[root@ccpvtt-54dc6fb788-t9ldd /]# curl http://ccpapi.ccp:82/api.txt
api
[root@ccpvtt-54dc6fb788-t9ldd /]# curl http://ccpapi.ccp:82/qq/qq.txt
qq
[root@ccpvtt-54dc6fb788-t9ldd /]# curl http://ccpapi.ccp:83/rpc.txt
rpc
[root@ccpvtt-54dc6fb788-t9ldd /]# curl https://ccpauth.dev.chinamcloud.cn/auth.txt
auth
[root@ccpvtt-54dc6fb788-t9ldd /]#
11. New planning. Called sequentially on the external network. View results. in line with expectations.
https://ccpauth.dev.chinamcloud.cn/auth.txt 响应成功,auth
https://ccpapi.dev.chinamcloud.cn/api.txt 响应 404,404 Not Found
https://ccprpc.dev.chinamcloud.cn/rpc.txt 响应 404,404 Not Found
http://ccpapi.ccp:82/api.txt 无响应,Failed to load response data
http://ccpapi.ccp:83/rpc.txt 无响应,Failed to load response data
12. Since in the development environment, the local environment of other services may need to call CCPI and CCPRPC. Therefore, it is necessary to support the external network call with CCPAPI and CCPRPC. Edit the rules of load balancing, ccpapi.dev.chinamcloud.cn:82, ccprpc.dev.chinamcloud.cn:83. as shown in Figure 7
13. New planning. Called sequentially on the external network. View results. in line with expectations.
https://ccpauth.dev.chinamcloud.cn/auth.txt 响应成功,auth
https://ccpapi.dev.chinamcloud.cn/api.txt 响应成功,api
https://ccprpc.dev.chinamcloud.cn/rpc.txt 响应成功,rpc
http://ccpapi.ccp:82/api.txt 无响应,Failed to load response data
http://ccpapi.ccp:83/rpc.txt 无响应,Failed to load response data






