Answer the question
In order to leave comments, you need to log in
How to properly setup nginx virtual host for this url?
Hello. Faced a problem (from my point of view) in the nginx setup. The point is the following.
I am migrating a Drupal 8 site to vds from a regular hosting. The hosting worked fine. When I clear the browser cache from the admin panel in the address bar of the browser with this action, we have
site.ru/admin/flush?token=SCRSNrTlLz3owG6oXxZOw-UXURZC03d8JYsCfWtKWJ0. After moving, when I try to clear the cache, the site gives an access error (Access denied. You are not authorized to access this page.) while I am authorized on the site.
server {
listen *:80;
server_name site.ru www.site.ru;
root /var/www/html/site.ru/web;
index index.php;
location / {
try_files $uri $uri/ /index.php?q=$uri$args;
}
return 301 https://$host:443$request_uri;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include fastcgi_params;
}
}
server {
listen 443 ssl;
server_name site.ru www.site.ru;
root /var/www/html/site.ru/web;
index index.php;
ssl on;
ssl_certificate /etc/letsencrypt/live/site.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/site.ru/privkey.pem;
location / {
try_files $uri $uri/ /index.php?q=$uri$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include fastcgi_params;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question