Demand
Original address: http://ip :54774/api_ Name
now requires you to access the specified port through the domain name: https://api.example.com/api_ name
realization
The most important thing is to configure the reverse proxy address of
location
When we enter the
domain name/API_ Name
will be mapped by nginx toIP or domain name: 54774/API_ Name
path go to the nginx directory, opennginx. Conf
, addreverse proxy
:server { listen 80; listen 443 ssl http2; server_name https://api.example.com; # Reverse Proxy location ~ ^/api_name { proxy_pass http://ip:54777; } #SSL-START SSL-related configuration, please do not delete or modify the next line with the comment 404 rules #error_page 404/404.html; ssl_certificate /www/server/panel/vhost/cert/api.example.com/fullchain.pem; ssl_certificate_key /www/server/panel/vhost/cert/api.example.com/privkey.pem; ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; add_header Strict-Transport-Security "max-age=31536000"; error_page 497 https://$host$request_uri; #SSL-END #ERROR-PAGE-START Error page configuration, which can be commented, deleted or modified #error_page 404 /404.html; #error_page 502 /502.html; #ERROR-PAGE-END #PHP-INFO-START PHP reference configuration, can be commented or modified #include enable-php-72.conf; #PHP-INFO-END #REWRITE-START URL rewrite rule reference, the modification will cause the panel to set the pseudo-static rules are invalid #include /www/server/panel/vhost/rewrite/api.example.com.conf; #REWRITE-END #Files or directories to which access is prohibited location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md) { return 404; } #One Click Application for SSL Certificate Verification Directory Related Settings location ~ \.well-known{ allow all; } }
overload configuration file:
./nginx -s reload
Read More:
- Nginx configuration 80 can be accessed by forcing jump 443 or not
- Nginx realizes the same background service for portal and business
- Solve the problem of 404 Not Found error in nginx accessing dynamic interface
- [Nginx] Solve the problem of being blocked by CORS policy: No’Access-Control-Allow-Origin’ header is present on the requested resource.
- [Solved] Nginx cannot access pictures on FTP Error: Whitelabel error page
- Solution of device eth0 does not see to be present, delaying initialization. Error in network card under Linux
- tuxedo Compile Background Common Error [How to Fix]
- [Solved] httpd:httpd:Could not reliably determine the server‘s fully qualif domain name,using ::1 for Se
- Hadoop 3.2.0 idea development environment construction and HDFS read write API operation
- Nginx Error: nginx: [emerg] the “ssl“ parameter requires ngx_http_ssl_module in /project/api/nginx.conf:
- [Solved] Ubuntu Error: Failed to connect to 127.0.0.1 port xxxxx: Connection refused
- [Solved] Git Error: OpenSSL SSL_read: Connection was reset, errno 10054和Failed to connect to github.com port 443
- The resolution of Ubuntu 16.04 screen can’t be modified and the solution of circulating login
- [Solved] svn: OPTIONS of ‘https://xxx/svn/xxx’: SSL handshake failed: SSL error: Key usage violation in certificate has been detected.
- Docker pull Command Error response from daemon: Head https://registry-1.docker.io/v2/library/
- [Solved] Failed to connect to 127.0.0.1 port XXXX: Connection refused
- Notes on Linux SCP command using specific port
- [Solved] WSUS client access server exception error – 0x8024401f
- [Solved] Web server failed to start. Port 8080 was already in use.
- Aliyunshield occupies port 80 error: Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use