Welcome! Log In Create A New Profile


config for Translucide CMS in URL/site/

Posted by Thatoo 
config for Translucide CMS in URL/site/
April 12, 2022 04:09PM

I’m trying to use the CMS Translucide 2 with Custom Webapp.

On my computer, a localhost without subfolder, the nginx conf file is as simple as follow :

server {
listen 80;
listen [::]:80;

root /home/thatoo/public_html/mywebsite;

# Add index.php to the list if you are using PHP
index index.php index.html index.htm;

server_name mywebsite.local;

# Don't allow access to dotfiles (such as .htaccess)
location ~ /\. {
deny all;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$args;

# pass PHP scripts to FastCGI server
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# default fastcgi settings
include fastcgi_params;

# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/run/php/php7.3-fpm.sock;

I wanted to set my website on my server on URL (mywebsite.com) + PATH (/site/) : https://mywebsite.com/site/

The best I could do is to set the config file of Translucide CMS as follow :

$GLOBALS['scheme'] = "https://";

$GLOBALS['domain'] = "mywebsite.com";

$GLOBALS['path'] = "/site/";

and the nginx conf as follow

location @handler {
rewrite ^/(.*)$ /site/index.php?^$1 last;

location /site/ {

# Path to source
alias /var/www/my_webapp/www/;

# Default indexes and catch-all
index index.php;
try_files $uri $uri/ @handler;

# Execute and serve PHP files
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm-my_webapp.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;

include conf.d/yunohost_panel.conf.inc;

location /site/theme/ {
more_set_headers 'Cache-Control: public';
expires 12h;
location /site/media/ {
more_set_headers 'Cache-Control: public';
expires 12h;

but the problem is that to make it work fully, I have to duplicate all folders and files in /var/www/my_webapp/www/ and in /var/www/my_webapp/www/site/

Indeed, some part of the code of Translucide CMS is
$scandir = array_diff(scandir($_SERVER['DOCUMENT_ROOT'].$GLOBALS['path']. "theme/".$GLOBALS['theme'].($GLOBALS['theme']?"/":""). "tpl/"), array('..', '.'));

so it scans the folder scandir(/var/www/my_webapp/www/site/theme/themename/tpl/) whereas their isn't any /site/ folder and it should scan instead scandir(/var/www/my_webapp/www/theme/namedutheme/tpl/)
but for that, I would need to set in Translucide config file
$GLOBALS['path'] = "/";

But if I do that, then I don't know how to set the nginx config file to work with URL + PATH ... only to make it work with URL.

Thank you in advance for any help given,
Bes regards to all nginx community,
Re: config for Translucide CMS in URL/site/
April 13, 2022 05:53PM
By the way, Translucide CMS is this one https://github.com/simonvdfr/Translucide and as you can read it has first been thought for Apache.

Edited 1 time(s). Last edit at 04/13/2022 05:54PM by Thatoo.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 250
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 466 on July 09, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready