Hello everyone, what’s the point: such an error occurs, it doesn’t particularly affect the work, but the link preview has stopped working, and I suppose it’s all connected. Is upstream formed correctly?
In logs writes an error:
2020/03/21 15:58:13 [error] 1299#1299: *162014 connect() failed (111: Connection refused) while connecting to upstream, client: 172.69.54.95, server: example.com, request: "GET / HTTP/1.1", upstream: "127.0.0.1:5623/https://example.com", host: "example.com"
Thanks for answers! Attach nginx file
upstream example {
server unix:/home/exapmle.com/website/backend/shared/tmp/sockets/puma.sock;
}
# for redirecting http traffic to https version of the site
server {
listen 80 ssl http2;
listen [::]:80;
server_name exapmle.com;
return 301 https://exapmle.com$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name exapmle.com;
access_log /var/log/nginx/exapmle_access.log;
error_log /var/log/nginx/exapmle_error.log info;
# Prerender
include /etc/nginx/features/prerender.conf;
# GZIP
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types
text/plain
text/css
application/json
application/javascript
text/xml
application/xml
application/xml+rss
text/javascript
image/svg+xml;
# SSL
ssl on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_stapling on;
resolver 8.8.8.8;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_certificate /etc/letsencrypt/live/exapmle.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/exapmle.com/privkey.pem;
# Other settings
charset utf-8;
# Path
root /home/exapmle/website/frontend/current/www;
location / {
include /etc/nginx/features/auth_basic.conf;
try_files $uri @prerender;
}
location @example {
proxy_pass http://example;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_redirect off;
}
location /sitemap.xml {
include /etc/nginx/features/auth_basic.conf;
root /home/example/website/backend/current/public;
}
location /uploads {
include /etc/nginx/features/auth_basic.conf;
root /home/example/website/backend/current/public;
expires 1y;
gzip_static on;
add_header Cache-Control public;
add_header ETag "";
access_log off;
try_files $uri @example ;
}
location ~ ^/(css|js)/ {
expires 1y;
add_header Cache-Control public;
add_header ETag "";
access_log off;
try_files $uri @example;
}
location ~ ^/images/ {
expires 600;
add_header Cache-Control public;
try_files $uri @example;
}
location /public {
include /etc/nginx/features/auth_basic.conf;
root /home/example/website/backend/current/public;
access_log off;
try_files $uri $uri/index.html @example;
}
location /api {
include /etc/nginx/features/auth_basic.conf;
root /home/exapmle/website/backend/current/public;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
if ($request_method = 'OPTIONS') {
return 204;
}
try_files $uri/index.html $uri @exapmle;
}
location /api/one_s {
auth_basic off;
try_files $uri @exapmle;
}
location /soap {
include /etc/nginx/features/auth_basic.conf;
root /home/example/website/backend/current/public;
try_files $uri @example ;
}
location /admin {
include /etc/nginx/features/auth_basic.conf;
root /home/example/website/backend/current/public;
try_files $uri/index.html $uri @example;
}
location /ckeditor {
include /etc/nginx/features/auth_basic.conf;
root /home/example/website/backend/current/public;
try_files $uri @example;
}
location ~ ^/assets/ {
include /etc/nginx/features/auth_basic.conf;
root /home/example/website/backend/current/public;
gzip_static on;
expires 1y;
add_header Cache-Control public;
add_header ETag "";
access_log off;
}
location ~ /.well-known {
root /var/www/html;
allow all;
}
keepalive_timeout 10;
client_max_body_size 1G;
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I solved the problem, there was a prerender service, and for some reason it did not start - the problem is solved. Thanks to all.
Hi there @alllstar02031998,
Your configuration actually looks correct. Have you restarted your Nginx service after your last changes? As far as I can see from the error, it is trying to connect on port
5623
but there are no rules in your Nginx config for that port.I could also recommend running an Nginx config test to make sure that there are no errors:
Here is also a quick video demo on how to do that:
Let me know how it goes! Regards, Bobby