• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • 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.

Clean URL drupal 7.4 plesk 12

JCV

New Pleskian
Hi.

My server is a debian 7 64 bits with plesk 12 last update.



A customer installed drupal 7.4 from plesk panel successful. However from Drupal/Configuration admin panel can not enable "Clean url". Clean test url failed too:

"The clean URL test failed"

.htaccess was ok .

I tried set domain vhost.con with (https://www.drupal.org/getting-started/clean-urls#enabling-7):
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
</IfModule>

But it not worked (IApache have module rewrite loaded.)

I think maybe issue y for nginx. But I don't know how set this ->https://www.drupal.org/node/976392 in nginx.conf of domain in plesk.

Anybody have can set clean url of Drupal in Plesk 12?

Thanks.
 
Below are the Nginx directives for Drupal:
Code:
# deny running scripts inside writable directories
location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
   return 403;
  error_page 403 /403_error.html;
}
   
# Support Clean (aka Search Engine Friendly) URLs
location / {
  rewrite ^/(.*)$ /index.php?q=$1;
}

# caching of files
location ~* \.(ico|pdf|flv)$ {
   expires 1y;
}

# Expire cache for images after 14 days
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
   expires 14d;
}
 
Thanks abdi.

I tested with vhost_nginx.conf:

location @drupal {
rewrite ^(.*)$ /index.php?q=$1 last;
}

But it not worked.
 
I am not sure about what you used "@drupal" the much I know is:
Code:
[...]
location / {
rewrite ^/(.*)$ /index.php?q=$1;
}
[...]
 
I am not sure about what you used "@drupal" the much I know is:
Code:
[...]
location / {
rewrite ^/(.*)$ /index.php?q=$1;
}
[...]

Thanks abdi.

If I use without @drupal in vhost_nginx.conf an error appears because "location /" exits on nginx.conf (and this file can NOT MODIFY BECAUSE IT WAS GENERATED AUTOMATICALLY).
 

Attachments

  • nginx.png
    nginx.png
    51.6 KB · Views: 2
That's correct you can't have 2 lines of location / {.
In that case, just add the line below (in the already existent location / {)
Code:
rewrite ^/(.*)$ /index.php?q=$1;
 
If add from "extra nginx directives" in panel only the line:

rewrite ^/(.*)$ /index.php?q=$1;

I can save it, but when I load in my browser the domain it say: "Page not found". Then I must delete the line "rewrite ^/(.*)$ /index.php?q=$1;"

I will don't like modify the /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php because there are a lot lines with "location":

***************************************************************************************************************************
<?php if ($VAR->domain->physicalHosting->proxySettings['fileSharingPrefix']): ?>
location ~ ^/<?php echo $VAR->domain->physicalHosting->proxySettings['fileSharingPrefix'] ?>/ {
<?php echo $VAR->includeTemplate('domain/service/proxy.php', $OPT); ?>
}
<?php endif; ?>

<?php endif; ?>

<?php if ($VAR->domain->physicalHosting->proxySettings['nginxServeStatic']): ?>

location @fallback {
<?php echo $VAR->includeTemplate('domain/service/proxy.php', $OPT); ?>
}

<?php echo $VAR->includeTemplate('domain/service/nginxProtectedDirectories.php', $OPT); ?>

location ~ ^/(.*\.(<?php echo $VAR->domain->physicalHosting->proxySettings['nginxStaticExtensions'] ?>))$ {
try_files $uri @fallback;
}
<?php endif ?>

<?php if ($VAR->domain->physicalHosting->php && $VAR->domain->physicalHosting->proxySettings['nginxServePhp']): ?>

<?php if ($VAR->domain->physicalHosting->hasWebstat): ?>
location ~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon) {
<?php echo $VAR->includeTemplate('domain/service/proxy.php', $OPT); ?>
}
<?php endif; ?>

location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ {
alias <?php echo $VAR->domain->physicalHosting->webUsersDir ?>/$1/$2;
<?php echo $VAR->includeTemplate('domain/service/fpm.php'); ?>
}

location ~ ^/~(.+?)(/.*)?$ {
<?php echo $VAR->includeTemplate('domain/service/proxy.php', $OPT); ?>
}

<?php echo $VAR->includeTemplate('domain/service/nginxWordpress.php'); ?>

location ~ \.php(/.*)?$ {
<?php echo $VAR->includeTemplate('domain/service/fpm.php'); ?>
}

<?php echo $VAR->includeTemplate('domain/service/nginxWordpressIndexing.php'); ?>

location ~ /$ {
<?php echo $VAR->domain->physicalHosting->proxySettings['directoryIndex'] ?>
}

***************************************************************************************************************************
 
Back
Top