• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Please beaware of a breaking change in the REST API on the next Plesk release (18.0.62).
    Starting from Plesk Obsidian 18.0.62, requests to REST API containing the Content-Type header with a media-type directive other than “application/json” will result in the HTTP “415 Unsupported Media Type” client error response code. Read more here

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