我有一个项目托管在带有 CloudPanel 面板的服务器上,它使用
nginx
作为 Web 服务器。在这个项目中,我有一个应用程序,我将调用cakephp1
,在cakephp1
中还有另一个应用程序,我将调用cakephp2
。两者都是cakephp
版本2.
项目的结构,简而言之,是这样的:
cakephp1/app/webroot/cakephp2/app/webroot
为了
cakephp1
工作,我必须将根 {{root}} 固定为:
/home/agenciatitanio-jobsnovo/htdocs/jobsnovo.agenciatitanio.com.br/webroot/app/webroot
注意:出现第一个webroot是因为cloudpanel在domain文件夹的根目录下自动创建了一个文件夹,也就是
jobsnovo.agenciatitanio.com.br
在这种情况下,
cakephp1
正常工作,因为我的nginx
正在作为 cakephp1 的 /app/webroot 文件夹的根目录
但是,在
cakephp2
,我遇到了很多问题。当我解决一个问题时,另一个问题出现了。目前,我能做的最好的是,使用下面的nginx
配置文件,加载cakephp2
应用程序,但是,它没有加载css或js。
在这种情况下,根应用程序是
cakephp1
,/cliente/
是cakephp2
。 cakephp2
(客户)的根是:
/home/agenciatitanio-jobsnovo/htdocs/jobsnovo.agenciatitanio.com.br/webroot/app/webroot/cliente/app/webroot/
到目前为止,这是我的
nginx
配置:
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
{{ssl_certificate_key}}
{{ssl_certificate}}
server_name jobsnovo.agenciatitanio.com.br;
{{root}}
{{nginx_access_log}}
{{nginx_error_log}}
if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;
}
location ~ /.well-known {
auth_basic off;
allow all;
}
{{settings}}
location / {
{{varnish_proxy_pass}}
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_hide_header X-Varnish;
proxy_redirect off;
proxy_max_temp_file_size 0;
proxy_connect_timeout 720;
proxy_send_timeout 720;
proxy_read_timeout 720;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
}
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|map)$ {
add_header Access-Control-Allow-Origin "*";
expires max;
access_log off;
}
if (-f $request_filename) {
break;
}
}
server {
listen 8080;
listen [::]:8080;
server_name jobsnovo.agenciatitanio.com.br;
{{root}}
location / {
try_files $uri $uri/ /index.php?$args;
index index.php index.html;
}
location /cliente/ {
try_files $uri $uri/ /cliente/index.php?$args;
index index.php index.html;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files $uri =404;
fastcgi_read_timeout 3600;
fastcgi_send_timeout 3600;
fastcgi_param HTTPS "on";
fastcgi_param SERVER_PORT 443;
fastcgi_pass 127.0.0.1:{{php_fpm_port}};
fastcgi_param PHP_VALUE "{{php_settings}}";
}
if (-f $request_filename) {
break;
}
}
我怎样才能使
cakephp2
,在cakephp1文件夹内,在/webroot/app/webroot/cliente/app/webroot/
上,加载css?
注意:我是 stackoverflow 的新手,所以如果我遗漏了任何信息,我很抱歉。我可以澄清任何疑问,非常欢迎任何帮助。谢谢!
我已经通过更改位置
/cliente/
块完成了所有可能的测试,我已经更改了cakephp2
设置,我已经更改了位置客户端文件夹。
我希望我可以无误地服务
cakephp2
(客户端)应用程序