Answer the question
In order to leave comments, you need to log in
What am I doing wrong with nginx + cloudflare ssl setup?
In general, I decided to roll a certificate from Cloudflare onto the site so that for 15 years and not suffer with updates. Before that, there was Let'sencrypt. I installed everything on the server, started it - it works on default. But as soon as I tried to edit this file to work with the Cloudflare certificate, nothing came of it. I would be grateful for the help, somewhere I just need to change a couple of lines, but I can’t understand where, I tried a lot of options, but all to no avail
. This is the original from which I dance:
server {
listen 80;
server_name mydomain.com www.mydomain.com;
root /var/www/vanilla;
index index.php;
location ~* /\.git { deny all; return 403; }
location /build/ { deny all; return 403; }
location /cache/ { deny all; return 403; }
location /cgi-bin/ { deny all; return 403; }
location /uploads/import/ { deny all; return 403; }
location /conf/ { deny all; return 403; }
location /tests/ { deny all; return 403; }
location /vendor/ { deny all; return 403; }
location ~* ^/index\.php(/|$) {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
fastcgi_param X_REWRITE 1;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~* \.php(/|$) {
rewrite ^ /index.php$uri last;
}
location / {
try_files $uri $uri/ @vanilla;
}
location @vanilla {
rewrite ^ /index.php$uri last;
}
}
server {
listen 80;
listen [::]:80;
server_name mydomain.com www.mydomain.com;
return 302 https://$server_name$request_uri;
location ~* /\.git { deny all; return 403; }
location /build/ { deny all; return 403; }
location /cache/ { deny all; return 403; }
location /cgi-bin/ { deny all; return 403; }
location /uploads/import/ { deny all; return 403; }
location /conf/ { deny all; return 403; }
location /tests/ { deny all; return 403; }
location /vendor/ { deny all; return 403; }
location ~* ^/index\.php(/|$) {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
fastcgi_param X_REWRITE 1;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~* \.php(/|$) {
rewrite ^ /index.php$uri last;
}
location / {
try_files $uri $uri/ @vanilla;
}
location @vanilla {
rewrite ^ /index.php$uri last;
}
}
server {
# SSL configuration
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl on;
ssl_certificate /etc/ssl/certs/cert.pem;
ssl_certificate_key /etc/ssl/private/key.pem;
server_name mydomain.com www.mydomain.com;
root /var/www/vanilla;
index index.php
}
Answer the question
In order to leave comments, you need to log in
Department of telepathy, hello!!!
Can you even see the error? What exactly doesn't work?
The problem is definitely not in CF, because according to this instruction, I have already created 10 static sites and everything was ok. But the forum does not work.
Make one server with port 443 and cloud certificate, and configure everything on it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question