#1
As far as I know nginx ignores the .htaccess files. Are there instructions anywhere for using Trongate with an nginx webserver?

Regards
Michael
#2
Hi Michael, Nginx doesn't use .htaccess as that is for the Apache server. I am a little busy this morning but will repost a solution for you soon that was posted on the SCA forum by Tref.
#3
Hi,
I am using nginx on all my projects and would really like to continue using it, preferably also with trongate. Seems I can't register on the SCA forum. Any chance of getting access to the nginx configuration anyway ... is it a secret ;) ?

-- update --

figured it out ... not special config, just make sure the root is pointing to the right (public) location of your app, for example for an app called "test"

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

root /var/www/html/test/public;
index index.php index.html index.htm;

location / {
try_files $uri $uri/ index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
#4
My nginx server block looks very similar. However, setting root to public directory means that the asset files in the modules directories above are inaccessible. Or am I wrong?
#5
no secret blacky831, the SCA forum is for members of Speedcoding Academy. I had to close the forum to new users because I was getting so much spam.

The reason I haven't posted Tref's fix was because I could not get it to work with my Docker install of Nginx 1.20.2 stable via DevilBox. I'm always getting a 403 forbidden message, even with your suggestion above. Even tried chmod -R 755 ...

Here's Tref's post anyway - may or may not help:

"I thought this might be easy, but it's taken me ages to get it working. After the initial hurdle (getting NGINX and PHP working on Windows, not so bad actually) I tried about every combination I could to get this working. The default rewrite command try files actually almost worked for everything, but I wasn't getting the admin files to pass through, and after trying a couple of things and getting it working, I decided to move my app into a subdirectory, then I was essentially back to square one! I think I have it now though...

My config.php has my app as http://localhost/app/ so replace anything with those words in the below to suit requirements...

Here's the server object in the nginx.conf file

For the admin files, I've just done a straight rewrite which works well. I've got that higher than my /app directory, I'm not sure it makes a difference...

In location /app, I had to specify the root again, it says you shouldn't need to do this, but it didn't work without it. The root is using the location of my nginx.exe as a base so "root www" means "the www folder in the same dir as nginx", in Linux I guess you'd want to use a full path.

The try files command works well, I've not seen any issues yet, I just made a quick app with one module, I could enter new data and browse data etc. so all the url parameters seem to be working well. Hope this helps!

#6
Thank you very much for sharing your solution.
It works for me. However, I will currently only use this configuration for local development purposes.