ECS布署nginx+nodesjs

ECS布署nginx+nodesjs

代码共享

我是把nodejs的代码目录当成了数据卷。然后nginx加载数据卷。
关键配置如下。

nodejs dockerfile

VOLUME ["/var/app"]

nginx container

"volumesFrom": [
        {
          "sourceContainer": "nodejs",
          "readOnly": true
          }
],

容器通信

brigde的方式有link方式连接。
我用的网络模式是awsvpc, 在awsvpc中可以直接通过localhost通信。
nginx配置示例如下。

upstream nodejs {
    server 127.0.0.1:3000;
    keepalive 256;
}

server {
    listen 80;
    location  /api/ {
        proxy_pass  http://nodejs/api/;
        proxy_set_header   Connection "";
        proxy_http_version 1.1;
        proxy_set_header        Host            $host;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

        expires 6h;
        add_header Pragma public;
        add_header Cache-Control "public";
        access_log off;
    }
}

需要规避的坑

我原来在nginx在支持2个站点。
通过server_name区分。
但是在ECS中的nginx中,server_name解析出来是localhost。
最后我只能分成两个server。

ECS布署nginx+nodesjs》有1个想法

  1. Service “Master Cleaning” was created in in the first half of the two thousandth year with a specific task: to perform a quality cleaning services in reliable, friendly and honest manner that is not only which not just satisfies and delights our client! With deep cleaning, employees of our company clean any windows and internal parts lampsplinth in the house.
    Today is a extremely important cleaning work, she will leave your beloved penthouse immaculate . Regardless you’re , drive in you or not Clean Master has the ability there to help to inject your new or old home impeccable view .
    Co-worker “Cleaning Service” can decide every problem, conjugate with guidance purity. You You can contact in “Cleaning Service” – our employees quickly and to the conscience to cope with the work of any size.
    Our Cleaning the famous company glad help you solve this a problem!
    Our Employees firms we carry out cleaning services only with eco-means, they to the full not dangerous and not even litter environment atmosphere.
    Created by us the organization provides large spectrum work on cleaning, you need only correctly select, appropriate to you view of cleaning, and contact to us for help. In our the company hourly work cooperator.

    Our company ready to provide services for cleaning – professional (technical) cleaning. Cleaning international company – carries out production activity on cleaning houses, objects, premises, rooms, offices and apartments. tactful, Courteous, Suave, Warning, Polite, Attentive, Respectful and Helpful attendants, high quality equipment and use only safe detersive substances – that’s what highlights our organization fromother cleaning organizations.
    We have working only prepared masters, having a mandatory practical experience. We have use the best, not harmful , , detergents and scouring materials, reliable, productive and professional equipment and outfit.

    Good Specialists the firms Service-Cleaning the assist to make your own mansion cozy.

    Find a cleaner. – [url=https://www.cleaning-master.com/]airbnb cleaning[/url]

发表评论

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