I have working lighttpd + django server but i wanna php too for example: www.mydomian.com is django homepage and www.mydomian.com/owncloud is owncloud distribution. Is posible to do that? Really sorry for my terrible english ;) And here is my lighttpd.conf

我有一个工作的lighttpd + django服务器,但我也想要php。www.mydomian.com是django主页,www.mydomian.com/owncloud是自己的云分布。是否可以这样做?很抱歉,我的英语很糟糕。这是我的打火机

server.modules = (
    "mod_access",
    "mod_alias",
    "mod_compress",
    "mod_redirect",
        "mod_rewrite",

)
server.document-root        = "/var/www"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80


index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

$SERVER["socket"] == "localhost:443" {
    ssl.engine = "enable"
        ssl.pemfile = "/etc/lighttpd/ssl/server.pem"  
    }
$HTTP["url"] =~ "^/owncloud/data/" {
        url.access-deny = ("")
}

#$SERVER["socket"] == "localhost:8000" {
#server.document-root = "/var/www/"   
# prawa dostępu dla "http"


fastcgi.server += (
    "/projekt.fcgi" => (
        "main" => (
            "host" => "127.0.0.1",
            "port" => 3033,
            #"socket" => "/var/www/projekt.sock",
            "check-local" => "disable",
        )
    )
)
fastcgi.server += (
    "/admin.fcgi" => (
        "admin" => (
            "host" => "127.0.0.1",
            "port" => 3033,
            #"socket" => "/var/www/projekt.sock",
            "check-local" => "disable",
        )
    )
)
alias.url = (
    "/static" => "/var/www/static",
    "/media" => "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/",
)
url.rewrite-once = (
"^(/static.*)$" => "$1",
"^(/Media.*)$" => "$1",
"^(/.*)$" => "/projekt.fcgi$1",
"^(/owncloud.*)$" => "index.php$1",
)
#}

And This:

这:

# -*- depends: fastcgi -*-
# /usr/share/doc/lighttpd/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi

## Start an FastCGI server for php (needs the php5-cgi package)
fastcgi.server += ( ".php" => 
    ((
        "bin-path" => "/usr/bin/php-cgi",
        "socket" => "/var/run/lighttpd/php.socket",
        "max-procs" => 1,
        "bin-environment" => ( 
            "PHP_FCGI_CHILDREN" => "4",
            "PHP_FCGI_MAX_REQUESTS" => "10000"
        ),
        "bin-copy-environment" => (
            "PATH", "SHELL", "USER"
        ),
        "broken-scriptfilename" => "enable"
    ))
)

Thank you for any help, Sierran

谢谢你的帮助,Sierran

EDIT

Now work great. But SSL work only on server IP not in domian. Updated config file:

现在的工作很好。但是SSL只在服务器IP上运行,而不是在domian中。更新配置文件:

server.modules = (
    "mod_access",
    "mod_alias",
    "mod_compress",
    "mod_redirect",
        "mod_rewrite",

)
server.document-root        = "/var/www/"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80


index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

#$SERVER["socket"] == ":443" {
#   ssl.engine = "enable"
#        ssl.pemfile = "/etc/lighttpd/ssl/server.pem"  
#   server.name = "mydomian.eu"
#      
#}


$HTTP["url"] =~ "^/owncloud/data/" {
        url.access-deny = ("")
}


$SERVER["socket"] == ":443" {
    ssl.engine = "enable"
    ssl.pemfile = "/etc/lighttpd/ssl/server.pem"
    $HTTP["host"] == "mydomian.eu" {
            ssl.pemfile = "/etc/lighttpd/ssl/mydomian.eu.pem" 
        }
    }

$HTTP["host"] =~ "^(www\.)?mydomian\.eu" {
server.document-root = "/var/www/" 
fastcgi.server += (
    "/projekt.fcgi" => (
        "main" => (
            "host" => "127.0.0.1",
            "port" => 3033,
            #"socket" => "/var/www/projekt.sock",
            "check-local" => "disable",
        )
    )
)

url.rewrite-once = (
"^(/static.*)$" => "$1",
"^(/Media.*)$" => "$1",
"^(.*)$" => "/projekt.fcgi$1",
)
}

alias.url = (
    "/static" => "/var/www/static",
    "/media" => "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/",
)

1 个解决方案

#1


2

It doesn't really matter what type of server-rendering software you're running (eg. Apache, lighttpd, etc.) so long as you can install the necessary PHP and Python packages on the OS itself (with any *nix-server OS, like Ubuntu-server/CentOS, this is very easy to do).

你运行的是哪种类型的服务器渲染软件并不重要。Apache、lighttpd等)只要您能够在OS本身上安装必要的PHP和Python包(使用任何*nix-server OS,如Ubuntu-server/CentOS,这是非常容易做到的)。

Although I'm not familiar with lighttpd, what I would consider is to instead map the owncloud software to a subdomain:

虽然我不太熟悉lighttpd,但是我可以考虑将owncloud软件映射到一个子域:

owncloud.mydomain.com

owncloud.mydomain.com

Dealing with subdomains is much easier than /link URLs. Also, you will avoid conflicts with /link as you may want to create more links within django itself (for other pages).

处理子域比/链接url容易得多。此外,您将避免与/link发生冲突,因为您可能希望在django本身(对于其他页面)中创建更多的链接。

What you will need to do is to create special use-cases for the different parts of your website using your lighttpd software. For example, you will make a provision for:

您需要做的是使用lighttpd软件为网站的不同部分创建特殊的用例。例如,你将为:

mydomain.com/www.mydomain.com owncloud.mydomain.com

mydomain.com/www.mydomain.com owncloud.mydomain.com

I hope my logic makes sense to you. If you need more info, comment on my post and we can edit it until the right answer is available.

我希望我的逻辑对你有意义。如果你需要更多的信息,请评论我的文章,我们可以编辑它,直到找到正确的答案。

更多相关文章

  1. 当我将它移动到另一台服务器时,计数器将无法工作
  2. 在Capistrano任务中引用当前服务器
  3. PHP获取服务器端的相关信息
  4. 使用ajax在服务器端恢复json时出错
  5. php清理当前目录下的指定文件和空目录(源码),建议服务器端执行
  6. Codeigniter在localhost中的url上没有index.php但在服务器中没有
  7. 自动同步vps服务器或本地文件的数据到百度网盘
  8. SQL调优案例,MYSQL服务器CPU100%问题解决
  9. 阿里云服务器远程连接mysql

随机推荐

  1. 双机高可用、负载均衡、MySQL(读写分离、
  2. 我想开始学习Linux网络编程和android开发
  3. 《鸟哥的Linux私房菜》读书笔记6——其它
  4. Linux 下nice 函数用法提高一个进程的友
  5. Ubuntu系统环境变量详解
  6. Linux下安装和使用杀毒软件AntiVir
  7. Linux-C语言函数手册
  8. Linux的那些事儿(10)----grep命令以及正则
  9. 设置查看linux 造成程序Core dumped 的函
  10. 剑指Offer——知识点储备--Linux基本命令