发表于: 2017-06-05 17:47:06

1 1102


近日完成

1: 安装Nginx 到一个服务器


2: 配置二级域名

    配置二级域名的过程如下

        1: 要在域名商那里把耳机域名注册下,

            比如我的域名leihao.info,我在godaddy那里增加了两个域名一个是enrollment.leihao.info,另外一个是blog.leihao.info

        2: 在Nginx那里配置reverse proxy

            reverse proxy会把访问转向指定位置

           首先增加了一个服务器安装了tomcat,

           在Nginx里面 的配置文件中增加了

server {                                          

    listen      80;                                                         

    server_name enrollment.leihao.info www.enrollment.leihao.info;          

                                                                            

    charset utf-8;                                                          

#    access_log /var/log/nginx/log/static.access.log main;                  

                                                                            

    location / {                                                            

        proxy_set_header   X-Real-IP $remote_addr;                          

        proxy_set_header   Host      $http_host;                            

        proxy_pass         http://172.17.0.6:8080;                

    }

          这样,但凡是要访问enrollment.leihao.info的请求,都会被转向安装有tomcat的服务器(172.17.0.6:8080)

3: 把任务2打包成war

4: 部署war到tomcat服务器。只需要把war 文件扔到tomcat/webapps目录下,tomcat会自动解压部署war

    我的项目部署在了

     enrollment.leihao.info/enrollment/

5: Nginx的access记录存放在/var/log/nginx下

/var/log/nginx # ls

access.log  error.log   log

看访问记录也是很有趣的。。。

应该可以写个程序做统计,看记录我看到了这个

180.76.15.20 - - [05/Jun/2017:09:24:59 +0000] "GET / HTTP/1.1" 200 10410 "-" "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" "-"

180.76.15.24 - - [05/Jun/2017:09:25:42 +0000] "GET / HTTP/1.1" 200 10410 "-" "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" "-"

度娘spider还是蛮勤奋的。。。

6:学习TOP的使用

top - 09:45:57 up 6 days, 20:58,  2 users,  load average: 0.00, 0.01, 0.05

Tasks: 123 total,   1 running, 122 sleeping,   0 stopped,   0 zombie

%Cpu(s):  0.0 us,  0.2 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.2 st

KiB Mem :  3881900 total,   645424 free,  1184644 used,  2051832 buff/cache

KiB Swap:        0 total,        0 free,        0 used.  2138252 avail Mem 


  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                             

  890 root      20   0 1079156  43660  16684 S   0.3  1.1  16:45.25 dockerd                                                                                                             

    1 root      20   0   46164   6672   3948 S   0.0  0.2   0:13.64 systemd                                                                                                             

    2 root      20   0       0      0      0 S   0.0  0.0   0:00.03 kthreadd                                                                                                            

    3 root      20   0       0      0      0 S   0.0  0.0   0:01.05 ksoftirqd/0                                                                                                         

    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H 

搞了个4GB内存2核的服务器用。。。发现真的真的是浪费。。。看来原来512MB内存一核服务器应该够我用好久呢。。。




返回列表 返回列表
评论

    分享到