First official website http://nginx.org/en/download.html download the latest stable version of the source package, there is 1.16.1:
After uploaded to wlf under the user directory through soft rz, return to the previous unzipped:
Soft cd $ $ rz - the y- rz Waiting to receive. Start zmodem transmission. Press Ctrl + C to cancel. 100 % 1008 KB 1008 KB / S 00 : 00 : 01 0 the Errors $ CD .. $ Soft xzvf the tar / nginx- 1.16 . . 1 .tar.gz
Check before start the compilation:
$ cd nginx-1.16.1/ $ ./configure --prefix=/home/wlf/nginx --with-http_stub_status_module
Where the parameter http_stub_status_module is open stub_status module, which is mainly used to view the status of some Nginx information. test result:
Configuration summary + using system PCRE library + OpenSSL library is not used + using system zlib library nginx path prefix: "/home/wlf/nginx" nginx binary file: "/home/wlf/nginx/sbin/nginx" nginx modules path: "/home/wlf/nginx/modules" nginx configuration prefix: "/home/wlf/nginx/conf" nginx configuration file: "/home/wlf/nginx/conf/nginx.conf" nginx pid file: "/home/wlf/nginx/logs/nginx.pid" nginx error log file: "/home/wlf/nginx/logs/error.log" nginx http access log file: "/home/wlf/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"
Began to compile and install:
$ make && make install
Start nginx:
$ cd ~ $ cd nginx $ sbin/nginx nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
The reason given: in linux, ordinary users can only use more than 1024 port, and the port within 1024 can only be used by root, so here port 80 can only be used by root.
We vi modify configuration files in conf / nginx.conf, will change the port to 8787:
#gzip on; server { listen 8787; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; }
After the restart the discovery nginx has played well:
$ netstat -nlp | grep 8787 (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 0.0.0.0:8787 0.0.0.0:* LISTEN 29950/nginx: master