NGINX - admin forbidden
Hi,
When I try to install, the admin folder was forbidden, I'm using nginx, any ideas how to solve this ?
Hello @wsokc,
currently I haven't done so many attempts to use Formwork with nginx, I'm not used to its config syntax too. Have you found a solution eventually?
I agree with this, I use only nginx as it is much easier than another web/proxy server, all in one bottle!
haven't invented the configuration for nginx yet?
Hi @wsokc and @TOWUK, I've tried this nginx config. It's working by now, assuming you've already configured php-fpm. I'm still fine tuning it, let me know if it works for you.
server {
index index.html index.php;
# Adjust port and server name to your needs
listen 8088;
server_name localhost;
# Adjust web root to your needs
root /usr/local/var/www;
charset utf-8;
# Disable access to directory indexes
autoindex off;
location /site/templates/assets/ {
}
location ~ "^/admin/(assets|avatars)/.*" {
}
location / {
# Prevent direct access to Formwork folders but allow access to assets
rewrite ^/(admin|backup|cache|formwork|site|vendor)/.* /index.php last;
# Prevent access to specific files
rewrite ^/(.*)\.(md|yml|json)/?$ /index.php last;
rewrite ^/(\.(.*)|LICENSE|composer\.lock)/?$ /index.php last;
# Let all URI be processed by index.php
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
# Adjust PHP-FPM port to your needs
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
this dont work (admin panel)
