Last login: Fri Jan 5 11:35:35 on ttys001
localhost:~ zhangji$ ssh root@10.0.21.41
root@10.0.21.41's password:
Last login: Wed Dec 27 06:33:17 2017 from 10.0.72.46
[root@localhost ~]# ls
anaconda-ks.cfg excel-data Music Templates
Desktop excel-data.zip Pictures Videos
Documents install.log Public XZ11小镇概况.xlsx
Downloads install.log.syslog soft
[root@localhost ~]# whereis nginx
nginx: /usr/local/nginx
[root@localhost ~]# which nginx
/usr/bin/which: no nginx in (/usr/local/git/bin:/usr/local/python34/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
bin games include lib64 mysql openssl sbin sqlite3 uwsgi
etc git lib libexec nginx python34 share src
[root@localhost local]# cd nginx/
[root@localhost nginx]# ll
总用量 36
drwx------. 2 root root 4096 7月 4 2017 client_body_temp
drwxr-xr-x. 2 root root 4096 12月 27 06:35conf
drwx------. 2 root root 4096 3月 28 2017 fastcgi_temp
drwxr-xr-x. 2 root root 4096 3月 28 2017 html
drwxr-xr-x. 2 root root 4096 3月 30 2017 logs
drwx------. 12 root root 4096 6月 20 2017proxy_temp
drwxr-xr-x. 2 root root 4096 3月 28 2017 sbin
drwx------. 2 root root 4096 3月 28 2017 scgi_temp
drwx------. 2 root root 4096 3月 28 2017 uwsgi_temp
[root@localhost nginx]# cd conf
[root@localhost conf]# ll
总用量 64
-rw-r--r--. 1 root root 1077 3月 28 2017 fastcgi.conf
-rw-r--r--. 1 root root 1077 3月 28 2017 fastcgi.conf.default
-rw-r--r--. 1 root root 1007 3月 28 2017 fastcgi_params
-rw-r--r--. 1 root root 1007 3月 28 2017 fastcgi_params.default
-rw-r--r--. 1 root root 2837 3月 28 2017 koi-utf
-rw-r--r--. 1 root root 2223 3月 28 2017 koi-win
-rw-r--r--. 1 root root 3957 3月 28 2017 mime.types
-rw-r--r--. 1 root root 3957 3月 28 2017 mime.types.default
-rw-r--r--. 1 root root 3950 12月 27 06:35 nginx.conf
-rw-r--r--. 1 root root 2630 12月 8 06:06 nginx.conf.bak
-rw-r--r--. 1 root root 2656 3月 28 2017 nginx.conf.default
-rw-r--r--. 1 root root 636 3月 28 2017 scgi_params
-rw-r--r--. 1 root root 636 3月 28 2017 scgi_params.default
-rw-r--r--. 1 root root 664 3月 28 2017 uwsgi_params
-rw-r--r--. 1 root root 664 3月 28 2017 uwsgi_params.default
-rw-r--r--. 1 root root 3610 3月 28 2017 win-utf
[root@localhost conf]# cat nginx.conf
user root;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name 0.0.0.0;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /home/bigdata/www;
index index.html index.htm;
try_files $uri $uri/ /index.html;
client_max_body_size 1000m;
}
location /api {
# include uwsgi_params;
# uwsgi_pass 127.0.0.1:8000;
proxy_pass http://127.0.0.1:8000;
client_max_body_size 1000m;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 0.0.0.0:8888;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /home/ylh/;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
server {
# listen 8000;
# listen 0.0.0.0:8000;
# server_name somename alias another.alias;
# location /static/ {
# autoindex on;
# root /home/bigdata/webroot/static/;
# }
}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
server {
listen 8001;
server_name localhost;
location /static_plugin {
alias /home/bigdata/webroot/static/;
}
location / {
root /home/bigdata/www2;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /user {
proxy_pass http://127.0.0.1:8000;
}
location /api {
proxy_pass http://127.0.0.1:8000;
client_max_body_size 1000m;
}
location /admin {
proxy_pass http://127.0.0.1:8000;
}
}
server {
listen 8002;
server_name localhost;
location /static_plugin {
alias /home/bigdata/webroot/static/;
}
location / {
root /home/bigdata/www3;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ~ ^/api/ {
# proxy_pass http://127.0.0.1:8000;
# client_max_body_size 1000m;
rewrite /api/(.+)$ /$1 break;
proxy_pass http://10.0.21.176:8686;
}
location /user {
proxy_pass http://127.0.0.1:8000;
}
location /admin {
proxy_pass http://127.0.0.1:8000;
}
}
}
[root@localhost conf]# vi nginx.conf
[root@localhost conf]# vi nginx.conf
[root@localhost conf]# nginx -t
-bash: nginx: command not found
[root@localhost conf]# ll
总用量 68
-rw-r--r--. 1 root root 1077 3月 28 2017 fastcgi.conf
-rw-r--r--. 1 root root 1077 3月 28 2017 fastcgi.conf.default
-rw-r--r--. 1 root root 1007 3月 28 2017 fastcgi_params
-rw-r--r--. 1 root root 1007 3月 28 2017 fastcgi_params.default
-rw-r--r--. 1 root root 2837 3月 28 2017 koi-utf
-rw-r--r--. 1 root root 2223 3月 28 2017 koi-win
-rw-r--r--. 1 root root 3957 3月 28 2017 mime.types
-rw-r--r--. 1 root root 3957 3月 28 2017 mime.types.default
-rw-r--r--. 1 root root 4684 1月 5 06:00 nginx.conf
-rw-r--r--. 1 root root 2630 12月 8 06:06 nginx.conf.bak
-rw-r--r--. 1 root root 2656 3月 28 2017 nginx.conf.default
-rw-r--r--. 1 root root 636 3月 28 2017 scgi_params
-rw-r--r--. 1 root root 636 3月 28 2017 scgi_params.default
-rw-r--r--. 1 root root 664 3月 28 2017 uwsgi_params
-rw-r--r--. 1 root root 664 3月 28 2017 uwsgi_params.default
-rw-r--r--. 1 root root 3610 3月 28 2017 win-utf
[root@localhost conf]# cd ..
[root@localhost nginx]# ll
总用量 36
drwx------. 2 root root 4096 7月 4 2017 client_body_temp
drwxr-xr-x. 2 root root 4096 1月 5 06:00 conf
drwx------. 2 root root 4096 3月 28 2017 fastcgi_temp
drwxr-xr-x. 2 root root 4096 3月 28 2017 html
drwxr-xr-x. 2 root root 4096 3月 30 2017 logs
drwx------. 12 root root 4096 6月 20 2017proxy_temp
drwxr-xr-x. 2 root root 4096 3月 28 2017 sbin
drwx------. 2 root root 4096 3月 28 2017 scgi_temp
drwx------. 2 root root 4096 3月 28 2017 uwsgi_temp
[root@localhost nginx]# ./sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost nginx]# ./sbin/nginx -s reload
[root@localhost nginx]# cd conf/
[root@localhost conf]# cat nginx.conf
user root;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name 0.0.0.0;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /home/bigdata/www;
index index.html index.htm;
try_files $uri $uri/ /index.html;
client_max_body_size 1000m;
}
location /api {
# include uwsgi_params;
# uwsgi_pass 127.0.0.1:8000;
proxy_pass http://127.0.0.1:8000;
client_max_body_size 1000m;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 0.0.0.0:8888;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /home/ylh/;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
server {
# listen 8000;
# listen 0.0.0.0:8000;
# server_name somename alias another.alias;
# location /static/ {
# autoindex on;
# root /home/bigdata/webroot/static/;
# }
}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
server {
listen 8001;
server_name localhost;
location /static_plugin {
alias /home/bigdata/webroot/static/;
}
location / {
root /home/bigdata/www2;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /user {
proxy_pass http://127.0.0.1:8000;
}
location /api {
proxy_pass http://127.0.0.1:8000;
client_max_body_size 1000m;
}
location /admin {
proxy_pass http://127.0.0.1:8000;
}
}
server {
listen 8002;
server_name localhost;
location /static_plugin {
alias /home/bigdata/webroot/static/;
}
location / {
root /home/bigdata/www3;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ~ ^/api/ {
# proxy_pass http://127.0.0.1:8000;
# client_max_body_size 1000m;
rewrite /api/(.+)$ /$1 break;
proxy_pass http://10.0.21.176:8686;
}
location /user {
proxy_pass http://127.0.0.1:8000;
}
location /admin {
proxy_pass http://127.0.0.1:8000;
}
}
server {
listen 8003;
server_name localhost;
location /static_plugin {
alias /home/bigdata/webroot/static/;
}
location / {
root /home/bigdata/www4;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ~ ^/api/ {
# proxy_pass http://127.0.0.1:8000;
# client_max_body_size 1000m;
rewrite /api/(.+)$ /$1 break;
proxy_pass http://10.0.21.176:8686;
}
location /user {
proxy_pass http://127.0.0.1:8000;
}
location /admin {
proxy_pass http://127.0.0.1:8000;
}
}
}
[root@localhost conf]# cd /home/bigdata/
[root@localhost bigdata]# mkdir www4
[root@localhost bigdata]# cd www4
[root@localhost www4]# ll
总用量 0
[root@localhost www4]# vi index.html
[root@localhost www4]#
备注: 配置好了需要 nginx -s reload
:q上面显示了 --- insert ---- 这是插入模式 :wq 写入退出