我有工作lighttpd + django服務器,但我想要的PHP也是例如: www.mydomian.com是django主頁和www.mydomian.com/owncloud是owncloud分佈。有可能做到這一點?我可怕的英語真的很抱歉;)這是我的lighttpd.confphp和django在同一個lighttpd服務器上
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"
))
)
感謝您的幫助, Sierran
編輯現在
工作很棒。但是,SSL只能在服務器IP上工作,而不是在多米尼加。更新配置文件:
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/",
)
謝謝你的幫助。我搜索,當我有domian的時候很簡單,但現在我的服務器上只有ip addres:<我會在家裏嘗試更多。 – Sierran
將域名映射到服務器的IP地址並不困難。只需進入您的域名公司帳戶並將服務器IP地址映射到域(除非您已經知道)。祝你好運。 – Joe
工作Django +的PHP,但現在不是:<任何意見? – Sierran