【问题标题】:Nginx as proxy for LighttpdNginx 作为 Lighttpd 的代理
【发布时间】:2014-06-27 18:12:21
【问题描述】:

我尝试使用带有 nginx + gunicorn 的 django 服务器和用于 php 的 lighttpd。我应该如何将 nginx 配置为我的子域到 lighttpd 的代理?

例如。

myawesomesite.com => dajango 网站(工作)

cloud.myawesomesite.com => lighttpd php 服务器(不工作)

我真的在尝试

server {
    listen 80;
    server_name cloud.awesome.eu; 
location / {
       proxy_pass http://127.0.0.1:8080;
       #root /var/www;
    }
}

对于 SSL

server {
    listen 443 ssl;
    #ssl on;
    server_name cloud.awesome.eu;
    #root /var/www; 
    #ssl_certificate /etc/nginx/ssl/server.crt;
    #ssl_certificate_key /etc/nginx/ssl/server.key;
    index index.php;
    try_files $uri $uri/ /index.php?q=$uri&$args;
     location / {
        proxy_pass  http://127.0.0.1:8080;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header        Host            cloud.awesome.com;
        proxy_set_header        X-Real-IP       $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    }

}

所有配置示例都是针对 nginx + apache.. 我没有找到 nginx + lighttpd 的示例。

对不起我糟糕的英语:)

【问题讨论】:

    标签: php django nginx lighttpd


    【解决方案1】:

    现在一切都为我工作!

    server {
        listen 80;
        server_name cloud..eu; #change this
    location / {
           proxy_set_header X-Real-IP  $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_set_header Host $host;
           proxy_pass http://127.0.0.1:8080;
           #root /var/www;
        }
    }
    server {
        listen 443;
        ssl on;
        server_name cloud..eu; #change this
        #root /var/www; #change this
        ssl_certificate /etc/nginx/ssl/server.crt;
        ssl_certificate_key /etc/nginx/ssl/server.key;
         location / {
         proxy_set_header X-Real-IP  $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header Host $host;
         proxy_set_header        X-Forwarded-Proto $scheme;
         add_header              Front-End-Https   on;
         proxy_pass http://127.0.0.1:8080;
         proxy_redirect off;  
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2011-06-19
      • 2014-03-31
      • 1970-01-01
      • 2016-05-24
      • 2019-01-14
      • 1970-01-01
      • 2018-07-25
      • 2021-06-17
      • 2017-07-21
      相关资源
      最近更新 更多