这是我想做的事情
我必须运行我想要运行的独立网站:siteA.maindomain,com和siteB.maindomain.com
对于siteB,我希望能够使用mod_mysql_vhos vhost subdomainX.siteB.maindomain.com。
以下是我的lighttpd.conf文件的外观:
server.modules = (
"mod_access",
"mod_alias",
"mod_accesslog",
"mod_compress",
"mod_mysql_vhost",
"mod_ssi",
"mod_rewrite"
)
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
ssi.extension = ( ".html" )
server.document-root = "/var/www/maindomain/htdocs"
server.errorlog = "/var/log/lighttpd/error.log"
accesslog.filename = "/var/log/lighttpd/access.log"
index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm",
"index.lighttpd.html" )
fastcgi.debug = 1
static-file.exclude-extensions = (".pl", ".fcgi" )
server.port = 80
server.bind = "11.22.33.44"
server.pid-file = "/var/run/lighttpd.pid"
dir-listing.encoding = "utf-8"
server.dir-listing = "disable"
server.username = "www-data"
server.groupname = "www-data"
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ("text/plain", "text/html", "application/x-javascript", "text/css")
#include_shell "/usr/share/lighttpd/create-mime.assign.pl"
mysql-vhost.db = "vhost"
mysql-vhost.user = "lighttpd"
mysql-vhost.pass = "correct_password"
mysql-vhost.sql = "SELECT docroot FROM domains WHERE domain='?';"
mysql-vhost.hostname = "localhost"
mysql-vhost.port = 3306
$HTTP["host"] == "siteA.maindomain.com" {
server.document-root = "/var/www/siteA/htdocs"
accesslog.filename = "/var/www/siteA/htdocs/logs/access.log"
server.errorlog = "/var/www/siteA/htdocs/logs/error.log"
}
$HTTP["host"] == "siteB.maindomain.com" {
server.document-root = "/var/www/siteB/htdocs"
accesslog.filename = "/var/www/siteB/htdocs/logs/access.log"
server.errorlog = "/var/www/siteB/htdocs/logs/error.log"
}
这可以吗?
siteA.maindomain.com运行正常。
我无法访问siteB.maindomain.com网址。我得到了404.我做错了什么。
我确信我没有正确配置vhost subdomainX.siteB.maindomain.com
答案 0 :(得分:0)
确保您已正确设置siteB / htdocs。
由于siteA有效,您可以尝试(暂时)更改siteB.maindomain.com
server.document-root = "/var/www/siteB/htdocs"
至
server.document-root = "/var/www/siteA/htdocs"
然后看看是否有效。
此外,您可能希望登录mysql数据库以检查是否在vhost数据库中配置了siteB.maindomain.com。