Nginx proxy_pass SSL -
i have wordpress website running on 1 server , api mobile apps running on different server. domain.com points website server, , have domain.com/api forwarded api server. have ssl working website server don't know how set api server.
on website server have follow nginx configuration:
server { listen 80 default_server; listen [::]:80 default_server; server_name domain.com www.domain.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; include snippets/ssl-domain.com.conf; include snippets/ssl-params.conf; root /var/www/website; index index.php; server_name domain.com www.domain.com; ... location ^~ /api { proxy_pass http://ip_of_api_server; } }
on api server have follow nginx configuration:
server { listen 80 default_server; listen [::]:80 default_server; server_name _; location / { proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header x-nginx-proxy true; proxy_pass http://localhost:3000; proxy_ssl_session_reuse off; proxy_set_header host $http_host; proxy_cache_bypass $http_upgrade; proxy_redirect off; } }
this configuration working want have ssl connections api.
Comments
Post a Comment