[nginx]安装配置(ubuntu/windows)

/ 22评论 / 949阅读 / 1点赞

nginx

这是一个使用c发高性能免费开源软件,被用于网络中的负载均衡,端口转发,反向代理等。

我常用它来监听80端口中的http请求,通过判断这些http请求的域名,


ubuntu环境


下载安装nginx


编写server配置文件

直接由nginx提供服务

server {
        listen       80;                  #监听端口
        server_name  www.coolight.cool;   #域名
        #-------nginx----------
        location / {                      #链接的后半部分为空时
           root /home/0Acoolight/nginx/root;  #访问的文件所在目录
           index index.html index.htm;        #访问的文件名
        }

        location /hello {
           root /home/0Acoolight/nginx/root/hello;  #访问的文件所在目录
           index index.html index.htm;        #访问的文件名
        }
}

nginx提供php服务


nginx转发给其他端口

server {
        listen       80;
        server_name  tomcat.coolight.cool;
        #-------Tomcat---------
        location / {
            proxy_pass  http://localhost:8080/;

            proxy_set_header        Host            $host;
            proxy_set_header        X-Real-IP       $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            
            client_max_body_size 10m;
            client_body_buffer_size 128k;
            proxy_connect_timeout 90;
            proxy_send_timeout 90;
            proxy_read_timeout 90;
            proxy_buffer_size 4k;
            proxy_buffers 4 32k;
            proxy_busy_buffers_size 64k;
            proxy_temp_file_write_size 64k;
        }
}

Win环境

下载安装nginx

server {
        listen       80;
        server_name  tomcat.coolight.cool;
        #-------Tomcat---------
        location / {
            proxy_pass  http://localhost:8080;
            proxy_set_header        Host            $host;
            proxy_set_header        X-Real-IP       $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            client_max_body_size 10m;
            client_body_buffer_size 128k;
            proxy_connect_timeout 90;
            proxy_send_timeout 90;
            proxy_read_timeout 90;
            proxy_buffer_size 4k;
            proxy_buffers 4 32k;
            proxy_busy_buffers_size 64k;
            proxy_temp_file_write_size 64k;
        }
}

常用命令


常见问题

  1. Assumpmok说道:

    1990 May 27; 131 21 1147 50 online cialis

  2. escanty说道:

    Antibiotics are sort of vegan, sort of not vegan, but ultimately something a vegan shouldn t stress about or feel guilty about taking for various reasons is generic viagra safe vivax cases that would have been observed in the prophylactic phase would also have relapsed in the absence of post exposure prophylaxis

  3. Ambibrile说道:

    Dual agent chemoprotection by retroviral co expression of either MDR1 or MRP1 with the P140K mutant of O6 methylguanine DNA methyl transferase buying cialis online safely I did have really bad acne as a teenager and I had to take accutane twice but my adult acne hasn t been THIS bad

  4. THATHECOM说道:

    Thus creatinine clearance rate CCR defined as the volume of blood cleared of creatinine per minute closely approximates the GFR and is commonly used as a measure of GFR, which is more difficult to directly measure generic for cialis

  5. embeway说道:

    Sullivan SM et al cialis 5 mg best price usa 19, 20 A number of trials have directly evaluated the efficacy of OA OS strategies versus CMF cyclophosphamide, methotrexate, and fluorouracil chemotherapy for premenopausal women

  6. grenuenah说道:

    Half of the patients in the control group had a BNP drawn on day one, so although they didn t have the multiple BNP protocol, there may not have been much difference in the management of these patients, so we probably shouldn t be too surprised that there were no differences in outcomes zithromax iv

  7. grenuenah说道:

    cialis online reviews Kayla, USA 2022 05 30 10 29 49

  8. Coikemn说道:

    Heart failure is called congestive heart failure when fluid builds up in various parts of the body cialis from india

  9. VORVOSESK说道:

    Derick TewRYvwpuP 6 20 2022 where to buy cialis Although patients are often jaundiced, they enjoy normal life expectancies

  10. Injeway说道:

    cheapest cialis 20mg 1 307 1 271 1 250 1 200 1 200 1 188 1 187 1 122 1 122 1 122 1 113 1 109 1 056 1 030 1 000 1 000 89 000 10 000 6 000 5 547

  11. VORVOSESK说道:

    After subgroup analysis and sensitivity analysis, we found that Cristofanilli s research may cause heterogeneity 23 viagra nitric oxide Nondestructive determination of lignans and lignan glycosides in sesame seeds by near infrared reflectance spectroscopy

  12. VORVOSESK说道:

    ERОІ1 repressed the mesenchymal spindle shaped morphology of the MDA MB 231 and Hs578T cells and enhanced cell cell contact buy cialis 5mg This would be my first, so I don t know what to expect

  13. Injeway说道:

    In specific population such as cigarette smokers the use of ОІ carotene increases the risk of lung or prostate cancer 205, 206, 207, 212 cialis 20mg I knew about misoprostol before I miscarried specifically that it s not FDA- approved for use on pregnant women, but doctors continue to use it to induce labor, and that it often results in ruptured uteruses

  14. Great online game https://razorsharkplay.com/ where you can win money, buy your loved one a new phone or car, close the mortgage on a room and just two months, hurry up register and win.

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注