api.krishit.com
[Mon Jun 17 19:01:17.310887 2024] [proxy:error] [pid 993] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:5000 (localhost) failed
[Mon Jun 17 19:01:17.310973 2024] [proxy_http:error] [pid 993] [client 59.144.167.12:60358] AH01114: HTTP: failed to make connection to backend: localhost
[Mon Jun 17 19:01:17.311067 2024] [proxy:error] [pid 993] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:5000 (localhost) failed
[Mon Jun 17 19:01:17.311102 2024] [proxy_http:error] [pid 993] [client 59.144.167.12:60358] AH01114: HTTP: failed to make connection to backend: localhost
[Mon Jun 17 19:01:17.715945 2024] [proxy:error] [pid 1997] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:5000 (localhost) failed
[Mon Jun 17 19:01:17.719780 2024] [proxy_http:error] [pid 1997] [client 59.144.167.12:60359] AH01114: HTTP: failed to make connection to backend: localhost, referer: https://api.krishit.com/
[Mon Jun 17 19:01:17.720097 2024] [proxy:error] [pid 1997] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:5000 (localhost) failed
server {
listen 92.222.128.232:443 ssl;
server_name api.krishit.com www.api.krishit.com;
# Main proxy
#location / {
#proxy_pass http://localhost:5000;
#proxy_set_header Host $host; # ProxyPreserveHost On
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Proto https; # RequestHeader set X-Forwarded-Proto "https"
# Access-Control-Allow-Origin *
#add_header Access-Control-Allow-Origin *;
#add_header Access-Control-Allow-Origin "https://hrms.krishit.com" always;
#add_header Access-Control-Allow-Credentials "true" always;
location / {
if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Origin "https://hrms.krishit.com" always;
add_header Access-Control-Allow-Credentials "true" always;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
add_header Access-Control-Allow-Headers "Authorization, Content-Type, Accept, Origin, X-Requested-With" always;
return 204;
}
proxy_pass http://localhost:5000;
add_header Access-Control-Allow-Origin "https://hrms.krishit.com" always;
add_header Access-Control-Allow-Credentials "true" always;
}
# WebSocket (socket.io)
location /socket.io/ {
proxy_pass http://localhost:5000/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
}
error_log /var/log/apache2/domains/api.krishit.com.error.log error;
ssl_certificate /home/api.krishit/conf/web/api.krishit.com/ssl/api.krishit.com.pem;
ssl_certificate_key /home/api.krishit/conf/web/api.krishit.com/ssl/api.krishit.com.key;
ssl_stapling on;
ssl_stapling_verify on;
# TLS 1.3 0-RTT anti-replay
if ($anti_replay = 307) { return 307 https://$host$request_uri; }
if ($anti_replay = 425) { return 425; }
include /home/api.krishit/conf/web/api.krishit.com/nginx.hsts.conf*;
location ~ /\.(?!well-known\/|file) {
deny all;
return 404;
}
#location / {
# proxy_ssl_server_name on;
# proxy_ssl_name $host;
# proxy_pass https://92.222.128.232:8443;
#
# location ~* ^.+\.()$ {
# try_files $uri @fallback;
#
# root /home/api.krishit/web/api.krishit.com/public_html;
# access_log /var/log/apache2/domains/api.krishit.com.log combined;
# access_log /var/log/apache2/domains/api.krishit.com.bytes bytes;
#
# expires max;
# }
#}
location @fallback {
proxy_ssl_server_name on;
proxy_ssl_name $host;
proxy_pass https://92.222.128.232:8443;
}
location /error/ {
alias /home/api.krishit/web/api.krishit.com/document_errors/;
}
#proxy_hide_header Upgrade;
include /home/api.krishit/conf/web/api.krishit.com/nginx.ssl.conf_*;
}
For API we created another subdomain and install ssl and then proxy pass using above code
https://api.krishit.com/admin/getOverAllEmployeeRecords
through postman he checked
/home/hrms.krishit/web/hrms.krishit.com/public_html/HRMS-Server
node app.js
https://api.krishit.com/
in web browser we should get Cannot GET /
Comments
Post a Comment