1

我在主机中安装了 PLESK,并创建了一个子域“app.mysite.com”。在这个子域中,我使用以下结构上传了我的 codeigniter 项目:

在此处输入图像描述

当我尝试访问“css”文件夹以获取 boostrap.min.css 文件(app.mysite.com/css/bootstrap/css/bootstrap.min.css)时,我收到此禁止错误: 在此处输入图像描述

这是此站点的 HTTP 的附加指令: 在此处输入图像描述

而另一个用于 HTTPS: 在此处输入图像描述

该网站自动从 HTTP 重定向到 HTTPS。

最后,我将此代码添加到其他 nginx 指令中: 在此处输入图像描述

其他测试

我尝试更改“附加 nginx 指令”,以从 URL 中删除 index.php: 在此处输入图像描述

但是没有加载样式文件,codeigniter 读取 url 作为控制器调用返回“404 page not found”:

在此处输入图像描述

请,我需要有关此问题的帮助以及如何正确配置 nginx 以访问 css/、js/ 和 img/ 文件夹文件。谢谢

/编辑

我找到 app.mysite.com 子域的 nginx.conf 文件:

    #ATTENTION!
    #
    #DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
    #SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

    server {
            listen 206.189.5.184:443 ssl http2;

            server_name app.mysite.com;
            server_name www.app.mysite.com;
            server_name ipv4.app.mysite.com;

            ssl_certificate             /opt/psa/var/certificates/scfMQnEev;
            ssl_certificate_key         /opt/psa/var/certificates/scfMQnEev;
            ssl_client_certificate      /opt/psa/var/certificates/scfcJsJQ3;

            client_max_body_size 128m;

            root "/var/www/vhosts/mysite.com/app.mysite.com";
            access_log "/var/www/vhosts/system/app.mysite.com/logs/proxy_access_ssl_log";
            error_log "/var/www/vhosts/system/app.mysite.com/logs/proxy_error_log";

            location / {
                    proxy_pass https://206.189.5.184:7081;
                    proxy_set_header Host             $host;
                    proxy_set_header X-Real-IP        $remote_addr;
                    proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                    access_log off;

            }

            location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
                    proxy_pass https://206.189.5.184:7081;
                    proxy_set_header Host             $host;
                    proxy_set_header X-Real-IP        $remote_addr;
                    proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                    access_log off;

            }
            location @fallback {
                    proxy_pass https://206.189.5.184:7081;
                    proxy_set_header Host             $host;
                    proxy_set_header X-Real-IP        $remote_addr;
                    proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                    access_log off;

            }

            location ~ ^/(.*\.(ac3|avi|bmp|bz2|css|cue|dat|doc|docx|dts|eot|exe|flv|gif|gz|htm|html|ico|img|iso|jpeg|jpg|js|mkv|mp3|mp4|mpeg|mpg|ogg|pdf|png|ppt|pptx|qt|ra$
                    try_files $uri @fallback;
            }

            location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ {
                    alias /var/www/vhosts/mysite.com/web_users/$1/$2;
                    fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                    fastcgi_param PATH_INFO $fastcgi_path_info;
                    fastcgi_pass "unix:///var/www/vhosts/system/app.mysite.com/php-fpm.sock";
                    include /etc/nginx/fastcgi.conf;

            }

            location ~ ^/~(.+?)(/.*)?$ {
                    proxy_pass https://206.189.5.184:7081;
                    proxy_set_header Host             $host;
                    proxy_set_header X-Real-IP        $remote_addr;
                    proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                    access_log off;

            }

            location ~ \.php(/.*)?$ {
                    fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                    fastcgi_param PATH_INFO $fastcgi_path_info;
                    fastcgi_pass "unix:///var/www/vhosts/system/app.mysite.com/php-fpm.sock";
                    include /etc/nginx/fastcgi.conf;

            }
            location ~ /$ {
                    index "index.html" "index.cgi" "index.pl" "index.php" "index.xhtml" "index.htm" "index.shtml";
            }

            add_header X-Powered-By PleskLin;

            include "/var/www/vhosts/system/app.mysite.com/conf/vhost_nginx.conf";
    }

    server {
            listen 206.189.5.184:80;

            server_name app.mysite.com;
            server_name www.app.mysite.com;
            server_name ipv4.app.mysite.com;

            client_max_body_size 128m;

            return 301 https://$host$request_uri;
    }
4

0 回答 0