1. The current BASE URL is /, https://creditshopback.xxx.cn/ . It responds with 200. See Figure 1.

2. Edit the program file to output the current version number: 2.6.4. See Figure 2.

echo Configure::version();
exit;
3. Now the expected URL is adjusted to: https://console.xxx.cn/creditshopback . Refer to the development installation guide: https://book.cakephp.org/2/zh/installation.html . See Figure 3.

4. View the current Nginx configuration.
server {
listen 82;
charset utf-8;
root /mcloud/creditshop_back/app/webroot;
index index.php;
location / {
# modsecurity on;
# modsecurity_rules_file /etc/nginx/modsec_includes_lite.conf;
if (!-e $request_filename) {
rewrite ^/(.+)$ /index.php?url=$1 last;
break;
}
}
location /creditf {
# modsecurity on;
# modsecurity_rules_file /etc/nginx/modsec_includes_lite.conf;
alias /webtv/wangjie/creditshop_back/h5jifen/files;
index index.html;
}
location /upload {
alias /webtv/wangjie/creditshop_back/upload;
index index.html;
}
# 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 /mcloud/creditshop_back/app/webroot$fastcgi_script_name;
include fastcgi_params;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
5. Move the directory: /mcloud/creditshop_back/* to /mcloud/creditshop_back/creditshopback/*. See Figure 4.

6. Edit the Nginx configuration.
server {
listen 82;
charset utf-8;
root /mcloud/creditshop_back/;
index index.php;
location / {
# modsecurity on;
# modsecurity_rules_file /etc/nginx/modsec_includes_lite.conf;
if (!-e $request_filename) {
rewrite ^/(.+)$ /index.php?url=$1 last;
break;
}
}
location /creditshopback/creditf {
# modsecurity on;
# modsecurity_rules_file /etc/nginx/modsec_includes_lite.conf;
alias /webtv/wangjie/creditshop_back/h5jifen/files;
index index.html;
}
location /creditshopback/upload {
alias /webtv/wangjie/creditshop_back/upload;
index index.html;
}
# 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 /mcloud/creditshop_back/$fastcgi_script_name;
include fastcgi_params;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
7. A 404 error exists in the response. The URL is: https://console.xxx.cn/creditshopback/css/common.css . It needs to be adjusted to: https://console.xxx.cn/creditshopback/app/webroot/css/common.css . See Figure 5.

8. In the directory: /app/View, bulk replace echo $this->Html->css(‘ with echo $this->Html->css(‘/app/webroot/css/. Strings like echo $this->Html->css(‘cake.generic’); are not replaced. See Figure 6.

9. In the directory: /app/View, bulk replace echo $this->Html->script(‘ with echo $this->Html->script(‘/app/webroot/js/. Strings like echo $this->Html->css(‘cake.generic’); are not replaced.
10. No 404 error exists in the response. https://console.xxx.cn/creditshopback/app/webroot/css/common.css . It responds with 200. See Figure 7.

11. Open the URL: https://console.xxx.cn/creditshopback/products/AddNewProduct?tenantid=2a20ea857030b75d3efa343cd625ee03 . It responds with 404.
12. Reference URL: https://www.shuijingwanwq.com/2018/08/16/2836/ . Edit the Nginx configuration.
server {
listen 82;
charset utf-8;
root /mcloud/creditshop_back;
index index.php;
location /creditshopback {
alias /mcloud/creditshop_back/creditshopback/app/webroot/;
location = /creditshopback {
try_files $uri /creditshopback/creditshopback/app/webroot/index.php$is_args$args;
}
try_files $uri $uri/ /creditshopback/creditshopback/app/webroot/index.php$is_args$args;
}
location /creditshopback/creditf {
# modsecurity on;
# modsecurity_rules_file /etc/nginx/modsec_includes_lite.conf;
alias /webtv/wangjie/creditshop_back/h5jifen/files;
index index.html;
}
location /creditshopback/upload {
alias /webtv/wangjie/creditshop_back/upload;
index index.html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ ^/.+\.php(/|$) {
rewrite (?!^/creditshopback/app/webroot)^/creditshopback(/.+)$ /creditshopback/app/webroot$1 break;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
try_files $fastcgi_script_name =404;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
13. Open the URL: https://console.xxx.cn/creditshopback/products/AddNewProduct?tenantid=2a20ea857030b75d3efa343cd625ee03 . It responds with 200.
14. Revert steps 8 and 9. The final result is that all responses return 200, as expected.
