I have an nginx backend server that has a lets encrypt certificate. Now, I want to add an nginx reverse proxy and create a lets encrypt certificate for it. However, when I try to reach http://jcp-connect.fr/.well-known/acme-challenge/test, i have 404
In my Nginx proxy configuration file at `/etc/nginx/sites-available/reverse I set the following:
server {
listen 80;
listen [::]:80;
server_name jcp-connect.fr;
index index.htm index.html;
location / {
try_files $uri/index.html $uri.html $uri @backend;
}
location ~ /\.well-known/acme-challenge {
root /usr/share/nginx/html;
}
location @backend {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://jcp-connect.fr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 900s;
}
}
My nginx backend server has an IP@ 192.168.1.45 and it is hosted in another machine and its nginx.conf file is set as follows:
http {
include mime.types;
index index.php index.html index.htm;
default_type text/html;
sendfile on;
keepalive_timeout 65;
gzip on;
client_max_body_size 1000M;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
server_name jcp-connect.fr;
ssl_certificate /etc/dehydrated/certs/jcp-connect.fr/cert.pem;
ssl_certificate_key /etc/dehydrated/certs/jcp-connect.fr/privkey.pem;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 32k;
fastcgi_buffers 4 32k;
fastcgi_busy_buffers_size 32k;
fastcgi_temp_file_write_size 32k;
client_body_timeout 10;
client_header_timeout 10;
send_timeout 60;
output_buffers 1 32k;
postpone_output 1460;
root /www/WebPortal/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
add_header X-Frame-Options sameorigin always;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (-f $request_filename) {
# fastcgi_pass 127.0.0.1:1026;
fastcgi_pass unix:/var/run/php7-fpm.sock;
}
}
}
}