• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Site not displaying properly on DocumentRoot

PRODUCT, VERSION, MICROUPDATE, OPERATING SYSTEM, ARCHITECTURE
plesk parrells ,12.0.18 ,Update #26 ,centos 7 , 64 bit
PROBLEM DESCRIPTION
file in documenRoot folder eg httpdocs wont display properly
STEPS TO REPRODUCE
create a new sLTubscriptions , then ftp files into document root folder using filezilla
ACTUAL RESULT
css and javascript file dont execute properly
EXPECTED RESULT
css and javascript files should execute properly
ANY ADDITIONAL INFORMATION
The weird thing is when I put the files into a subdirectory (eg www.example.com/home /) the site itself shows correctly. But when I put the files back into the document root folder(eg httpdocs) it doesn't show correctly .Also no css or javascript error messages show up in the chrome debug window ? What have i missed .Any help will be much appreciated and thank you in advance.
 
Any related errors in vhosts logs? Any results of troubleshooting?
 
There are a number of reasons why this behavior might occur that include everything from bad headers being sent to the browser to htaccess rules that might be preventing those files from being sent at all.

The better question is, when you say "css and javascript files should execute properly," are these files accessible by browsers in the document root? Have you moving everything (including any htaccess files) to a sub-directory and then in your document root uploading just a plain vanilla HTML file as well as a very basic CSS file?

To cover all bases without being condescending are you sure that you aren't using relative paths in the files located in the document root? I.e. referencing a CSS file as "../css/screen.css" which would never display properly when the referring file is placed in the document root.
 
Thanks for the reply guys

Don't worry about being condescending sometime it's the only way you learn :)

ive attahed two files for the vhost. 1 access log the other error log , it shows the last 250 lines for each one.

I don't have a .htaccess file in the document root folder and as for css and javascript files they are like this in code "eg ../css/screen.css" but when i hover over them in the chrome debug window they give the full path eg http://www.example.com.au/css/screen.css. Ive ran that bootstrapper repair command and ive also ran that htppdmg reconfigure all command as well , this problem has me stumped o_O. Ive disable nginx (because senior programmer has said it caused him issue in the past) ,could this have anything to do with it?
 

Attachments

  • access_log.txt
    62.2 KB · Views: 1
  • error_log.txt
    62.3 KB · Views: 1
Hi sir_luscious_left_foot,

sorry to say that, but if the "senior programmer" tells you "nginx caused him issue in the past"... please consider getting a new one, because he didn't even had a closer look on the issue.
Your issue is caused by missing correct rewrite - rules for apache and nginx for non - static - contents.

Please consider to provide the used software ( CMS ? board software ? shop software? ... ), so we could help with some basics here.
 
That's hash mate :D he's a busy guy :D

Anyway we are using a template cms site that we brought (to speed up development ) called smart admin php pulling data from mysql database. Database is either on the server or and a different server(different computer)
 
Hi sir_luscious_left_foot,

depending on your configuration ( with or without FastCGI, PHP is served by nginx or not... - please see your very own specific webhosting configuration for each domain or /subdomain for the settings ), you always have the possibility to define custom definitions.

For example:

HTML:
        location ~ /$ {
            index index.php index.cgi index.pl index.html index.htm index.xhtml index.shtml;
            try_files $uri $uri/ /index.php?$args;
        }
... can help to prevent issues as described but you could as well be more specific, if you add location definitions for your CSS and/or JS - folders. NGINX has a huge amount of possibilities and most software developers include suggestions how to setup rewrite rules. If this is not the case for your specific software, there might be a support forum or a community forum where they discuss such suggestions.

Sometimes it is even enough to define "if (!-e $request_filename){ rewrite ^(.*)$ /index.php break; }", but as you can see, this does not effect other files than "index.php".

Depending on your used software, it might be helpfull to adjust the global fastcgi parameters at "/etc/nginx/fastcgi_params" and just add a line like "fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;"

Another solution is to define custom definitions as you already see in your domain - specific nginx configuration file "/var/www/vhosts/system/YOURDOMAIN_OR_YOURSUBDOMAIN.DOMAIN.COM/conf/nginx.conf" ( or nginx_ip_default.conf ). As you can see, there is already a definition for PHP which could be adjusted with an addition like:

HTML:
    location ~ \.php {

        fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass "unix:/var/www/vhosts/system/YOURDOMAIN_OR_YOURSUBDOMAIN.DOMAIN.COM/php-fpm.sock";

        include /etc/nginx/fastcgi_params;
    }


As you can see, there are several ways to modify locations and you can define as well specific rules for your CSS, AJAX and JS - folders - that really depends on your server configurations, the used content on your domain or subdomain and the way it uses rewrites. Just be aware, that you can use location - definitions only ONCE, so you either have to combine definitions or modify the expressions. Please don't edit the existing nginx.conf ( or nginx_ip_default.conf ), because this might get overwritten by Plesk. Please use the text - box over the Plesk Control Panel at your domain specific webserver settings, or edit the additional "vhost_nginx.conf". More informations and as well examples can be found at: http://nginx.org/en/docs/
 
Back
Top