Environment:(CentOS 7)
1 [[email protected]_x1 nginx-1.11.10]$ uname -a 2 Linux netlab_x1 3.10.0-327.28.2.el7.x86_64 #1 SMP Wed Aug 3 11:11:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Download:
1 # download and uncompress 2 wget http://nginx.org/download/nginx-1.11.10.tar.gz 3 tar -zxvf nginx-1.11.10.tar.gz 4 cd nginx-1.11.10/
Installation: (tree command can help you understand the construction of the directory)
1 # configuration 2 ./configure 3 # compile 4 make 5 # install, permission needed. Default installation path: /usr/local/nginx 6 sudo make install
1 [[email protected]_x1 nginx]$ pwd 2 /usr/local/nginx 3 [[email protected]_x1 nginx]$ ls 4 client_body_temp conf fastcgi_temp html logs proxy_temp sbin scgi_temp uwsgi_temp 5 [[email protected]_x1 nginx]$ ll 6 total 8.0K 7 drwxr-xr-x 11 root root 142 Feb 17 13:13 . 8 drwxr-xr-x. 15 root root 4.0K Feb 17 12:27 .. 9 drwx------ 2 nobody root 6 Feb 17 13:13 client_body_temp 10 drwxr-xr-x 2 root root 4.0K Feb 17 12:27 conf 11 drwx------ 2 nobody root 6 Feb 17 13:13 fastcgi_temp 12 drwxr-xr-x 2 root root 38 Feb 17 12:27 html 13 drwxr-xr-x 2 root root 55 Feb 17 16:48 logs 14 drwx------ 2 nobody root 6 Feb 17 13:13 proxy_temp 15 drwxr-xr-x 2 root root 18 Feb 17 12:27 sbin 16 drwx------ 2 nobody root 6 Feb 17 13:13 scgi_temp 17 drwx------ 2 nobody root 6 Feb 17 13:13 uwsgi_temp 18 [[email protected]_x1 nginx]$ tree 19 . 20 ├── client_body_temp [error opening dir] 21 ├── conf 22 │ ├── fastcgi.conf 23 │ ├── fastcgi.conf.default 24 │ ├── fastcgi_params 25 │ ├── fastcgi_params.default 26 │ ├── koi-utf 27 │ ├── koi-win 28 │ ├── mime.types 29 │ ├── mime.types.default 30 │ ├── nginx.conf 31 │ ├── nginx.conf.default 32 │ ├── scgi_params 33 │ ├── scgi_params.default 34 │ ├── uwsgi_params 35 │ ├── uwsgi_params.default 36 │ └── win-utf 37 ├── fastcgi_temp [error opening dir] 38 ├── html 39 │ ├── 50x.html 40 │ └── index.html 41 ├── logs 42 │ ├── access.log 43 │ ├── error.log 44 │ └── nginx.pid 45 ├── proxy_temp [error opening dir] 46 ├── sbin 47 │ └── nginx 48 ├── scgi_temp [error opening dir] 49 └── uwsgi_temp [error opening dir] 50 51 9 directories, 21 files
Start:
1 [[email protected]_x1 nginx]$ sudo sbin/nginx 2 [[email protected]_x1 nginx]$ ps -ef | grep nginx 3 root 3285 1 0 16:48 ? 00:00:00 nginx: master process sbin/nginx 4 nobody 3286 3285 0 16:48 ? 00:00:00 nginx: worker process 5 leaf 4514 41344 0 18:04 pts/1 00:00:00 grep --color=auto nginx
Default Pages:(or http://localhost:80)
Simple Pages (Hello World!)
revise html:(html/index.html)
<!DOCTYPE html> <html> <head> <title>Hello World!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Hello World!</h1> <p><em>Start your journey on nginx!</em></p> </body> </html>
New pages:
Stop:
1 # Two ways 2 # In this way, the server would stop immediately. 3 sudo sbin/nginx -s stop 4 # In this way, the server would process the current tasks and exit 5 sudo sbin/nginx -s quit 6 # using ps command, the worker and master processes are quited 7 ps -ef | grep nginx
时间: 2024-12-28 23:21:18