Nginx Rewrite for Special Characters
Original URL:
borrowinfo.page?borrow_id=2017121500000000000000005173
Target URL:
/invest/info?borrowId=2017121500000000000000005173
if ($request_uri ~* "^/borrowinfo.page/?borrow_id=(/d+)$") {
…
Original URL:
borrowinfo.page?borrow_id=2017121500000000000000005173
Target URL:
/invest/info?borrowId=2017121500000000000000005173
if ($request_uri ~* "^/borrowinfo.page/?borrow_id=(/d+)$") {
…
nginx versions 1.3.12 and later support websocket, so update nginx first. I’m currently using version 1.6.0. server { listen 80; server_name 123.com www.123.com; root /www/web/123/public_html; index index.h …
Starting:
Navigate to the nginx directory and either double-click nginx.exe in the Nginx folder or run in cmd:
start nginx
Stopping
nginx -s stop
or
nginx -s quit
stop means to immediately stop nginx without saving related information
quit means to exit nginx normally, and …
How to Use Trailing Slashes in Nginx proxy_pass Correctly
When configuring proxy_pass in Nginx, adding a trailing slash (/) to the URL means it is treated as an absolute root path. In this case, Nginx will not forward the matched location path to the proxied server. Without the trailing slash, the matched path segment is also forwarded.
Test file is test.html, access http: …
Sometimes for security reasons, we want to block user access to files with specific extensions. Below we’ll cover the blocking method in Nginx; once configured, front-end access will directly return a 403 status code.
Sample code is as follows:
location ~ .*/.(jsp|php|asp|aspx|sql|dmp)$ {
…
Note: This file is the nginx configuration file nginx.conf. Settings here take effect globally. Please define the relevant variable names in your program in advance, and enable the access.log writing feature in nginx (enabled by default). 1. Enable underscore support (by default, underscores in variables are not recognized): vi /usr/local/nginx/conf/ngin …
Recently while working on a WeChat Mini Program, I ran into an issue: the TLS version must be greater than 1.2
Here’s how to fix it:
It’s common knowledge that WeChat Mini Programs only support HTTPS, so I won’t go into SSL configuration here. Below, using my Nginx setup as an example, I’ll show you how to resolve the TLS version requirement: vi /usr/local/nginx/conf/vhost/www. …
Note: The goal is to require visitors to enter a username and password before accessing the site.
The ngx_http_auth_basic_module allows access to web content only when the correct username and password are entered. Some content on the web is not meant for public viewing, but you still want to share it with a select group …
The system had tengine and the Yunsuo protection module installed and running normally, but recently tengine (nginx) has been misbehaving on restart 鈥?the backend is unreachable, and nginx has no worker processes, only a master process.
Checking the nginx logs shows large numbers of the following errors:
2016/09/18 …
Today, we ran into some issues on the project: the frontend uses a Tengine server to health-check the backend, and after restarting the Tengine server, it took a long time to return to normal.
So I checked the error logs and system information, and the symptoms were as follows:
1. The nginx error log showed:
worker process xxx exited on signal 1 …