• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Nginx Wildcard subdomain problem

Observateur

New Pleskian
Hello,

I have a problem with Nginx on myPlesk 12 with wildcard dns.

I want subdomains URl to be like root domain url. Exemple

http://*.domain.com/folder/folder/fileredirect to
http://www.domain.com/folder/folder/fileredirect to

You can see a live exemple here: http://bultraland.kouaa-blog.com/ CSS files (http://bultraland.kouaa-blog.com/templates/reic/reic.css) give error 404 instead of showing root domain file (http://www.kouaa-blog.com/templates/reic/reic.css). It's the same for images.

What specific rule I must add in plesk panel?
 
klyde,

In order to disable Nginx for a domain, admin should un-check (turn off) three settings below:
Websites & Domains > DOMAIN.TLD > Web Server Settings for DOMAIN.TLD
[ ] Smart static files processing
[ ] Serve static files directly by nginx
[ ] Process PHP by nginx


However, Nginx configs still will be created for the domain and nginx will listen for port 80
 
Last edited:
Observateur,

this can be done using Nginx rewrite rules, as example:
location / {
if ($http_host ~ "^(.*)\.domain\.com"){
rewrite ^(.*)$ http://domain.com/subdomains/%1/$1 redirect;
}
}

Nginx rewrite rules can be added for a website by ADMIN in
Websites & Domains > DOMAIN.TLD > Web Server Settings for DOMAIN.TLD > "Additional nginx directives"
 
Last edited:
klyde,

There is a technical possibility to do this in Plesk - using Nginx rewrite rules.
In order to be sure that Nginx rewrite rules are applied to static files, please check that Nginx serves static files on the website:

Websites & Domains > DOMAIN.TLD > Web Server Settings for DOMAIN.TLD
[*] Serve static files directly by nginx
 
Back
Top