Objective:
I installed nginx-echo-module The original intention is encountered some time ago, although there are configuration location rules, but in the browser access, there is an error, such as mismatch or do not meet the expected situation, want to know if there is actually a match which location rule, But Nginx log can only record the request URL, so, see echo output is very happy, after all, feel return is not so good, as a small white front end, can only write to this extent, you reference to teach it ~
- Download Nginx Source: Link: Https://pan.baidu.com/s/1m3ICsUnJ6XXilFdYrXDQXQ Password: 936t
- Download Nginx-echo-module Link: https://github.com/openresty/echo-nginx-module/releases/tag/v0.61
- The command line new folder, will download down the Nginx source extract, CD to the directory
./configure
sudo make
sudo make install
At this time, Nginx has been successfully installed into the system/usr/local/nginx directory, executable file is/usr/local/nginx/sbin in the Nginx file
Start command: Cd/usr/local/nginx/sbin
sudo./nginx
Reboot enables configuration to take effect sudo./nginx-s Reload
Stop the service sudo./nginx-s stop
4. Unzip the Nginx-echo-module and move to the 3 directory
sudo./configure--add-module=echo-nginx-module-0.61
sudo make
sudo make install
This process, because follow the online tutorial operation, however, the download of 0.60 and 0.58 in sudo make will be reported in the console 2 error, because no, remember the error is assignment type mismatch correlation, The error file is http-request.c, and later tried to download the 0.61 version of the link, re-executed from the. Configure once, found no error (this process is really suffering ah, I do not understand the details of nginx implementation, online and there are no many similar error messages, like the chicken as random test)
Next, Found Nginx installation directory nginx.conf does not allow the modification, try to modify the permissions in the file to read and write, but still no, can only tell the file copied to other changes and then overwrite back, personal other nginx configuration is placed in the Nginx installation directory of a new servers folder, inside a variety of domain names Configuration file
At this point, in any location/xxx configuration echo ' xxxxx ' and then access the domain name in the browser: Port number/location path, the browser will automatically download a file after the return, The content is the echo output of the string (here is not quite understand why, began to think that echo should be in the browser console output is right, perhaps not too much to do it), but so far, Nginx-echo is also able to use, not wasted a day
Note:
This method only applies to their own compiled Nginx source code, not for direct download installation Nginx (including NPM install,brew install, etc.), directly downloaded in the installation directory is not. Configure executable file!
Reference Links:
79305097
Mac compiler installs Nginx and Nginx-echo-module