php和django在同一个lighttpd服务器上
我有正在工作的lighttpd+django服务器,但我也想要php,例如: www.mydomian.com是django主页,www.mydomian.com/owncloud是owncloud发行版。有可能这样做吗?真为我糟糕的英语感到抱歉;)这是我的lighttpd.confphp和django在同一个lighttpd服务器上,php,python,django,lighttpd,Php,Python,Django,Lighttpd,我有正在工作的lighttpd+django服务器,但我也想要php,例如: www.mydomian.com是django主页,www.mydomian.com/owncloud是owncloud发行版。有可能这样做吗?真为我糟糕的英语感到抱歉;)这是我的lighttpd.conf server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_redirect", "mod_
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",
)
#}
这是:
# -*- 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"
))
)
谢谢你的帮助,
锡兰
编辑
现在工作很好。但是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/",
)
运行哪种类型的服务器渲染软件(如Apache、lighttpd等)并不重要,只要您可以在操作系统本身上安装必要的PHP和Python软件包(对于任何*nix服务器操作系统,如Ubuntu server/CentOS,这都很容易做到) 虽然我不熟悉LoTTDPD,但我会考虑将自己的云软件映射到子域: owncloud.mydomain.com 处理子域比处理/link URL容易得多。此外,您还可以避免与/link冲突,因为您可能希望在django本身(对于其他页面)中创建更多链接 您需要做的是使用lighttpd软件为网站的不同部分创建特殊用例。例如,您将为以下各项准备: mydomain.com/www.mydomain.com owncloud.mydomain.com
我希望我的逻辑对你有意义。如果您需要更多信息,请在我的帖子上发表评论,我们可以对其进行编辑,直到找到正确答案。谢谢您的回复。我搜索,当我有domian时,这很简单,但现在我的服务器上只有ip地址:<我会在家里尝试更多。将您的域映射到服务器的ip地址不是很难。只需进入您的域公司帐户并将服务器ip地址映射到域(除非您已经知道)。Goodluck.正在使用django+php,但现在ssl不是:<有什么建议吗?我以前使用过ssl,从我的记忆中,它映射到某个特定的域,如:www.mydomain.com。它可能只适用于www,而不适用于owncloud.mydomain.com(这可能需要它自己的证书)。试着和域名公司谈谈,看看他们怎么说。但是mydomian.com的证书不起作用。我不知道该怎么办。