我有一个在HTTPD 2.2下运行DokuWiki的CentOS 6.9服务器。该Wiki安装在/var/www/html/dokuwiki
中。因此,当您键入myserver.com/dokuwiki
时,它将进入Wiki。如果键入myserver.com
,将显示一个简单的index.html
文件(/var/www/html/index.html
),其中包含指向Wiki和GitLab的链接。
现在,我已经安装了GitLab并将其配置为也使用HTTPD(默认情况下,它与NGINX集成在一起)。如果我自己启动,GitLab和DokuWiki 都可以正常工作,但是我找不到找到使它们同时可见的方法。
我想要的是:如果用户输入myserver.com
,请显示index.html
并带有两个链接:一个指向Wiki(myserver.com/dokuwiki
),另一个指向其他链接到GitLab服务器(myserver.com/gitlab
)。通过单击每个,用户可以访问所需的服务。
发生的事情是,如果将gitlab的配置优先于其他配置(例如,通过将名称更改为00-gitlab.conf
),则Wiki的配置将不起作用,并且当您键入{ 1}}或myserver.com
,但找不到任何内容(
之所以显示myserver.com/dokuwiki
是因为它使用其他规则并且没有匹配项(我猜是由于GitLab的Not found "/"
指令)。在这种情况下,GitLab可以正常工作。
如果我将Wiki的配置放在优先位置,则在尝试访问Location
时会收到404错误,因为该规则更通用,因此它会忽略带有myserver.com/gitlab
指令的其他规则。在这种情况下,索引和Wiki可以正常工作。
这是两者的虚拟主机配置,存储在Location
中。一切都是SSL,一切正常。 HTTP(端口80)的配置实际上是相同的,但这里没有包括。我在/etc/httpd/conf.d
中也有NameVirtualHost *:443
。
Wiki / Root:
httpd.conf
GitLab
<VirtualHost *:443>
ServerName myserver.com
DocumentRoot /var/www/html
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/myserver.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/myserver.com.key
</VirtualHost>
谢谢。
答案 0 :(得分:1)
我找到了解决方案。我只需要一个VirtualHost并正确定义我的proxypass。
这是工作文件:
<VirtualHost *:443>
ServerName myserver.com
DocumentRoot /var/www/html
SSLEngine on
SSLProtocol all -SSLv2
SSLHonorCipherOrder on
SSLCipherSuite "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS"
Header add Strict-Transport-Security: "max-age=15768000;includeSubdomains"
ServerSignature Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode
SSLCertificateFile /etc/httpd/ssl/myserver.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/myserver.com.key
Alias /gitlab /opt/gitlab/embedded/service/gitlab-rails/public
<Location /gitlab>
Order deny,allow
Allow from all
ProxyPass http://127.0.0.1:8181
ProxyPassReverse http://127.0.0.1:8181
ProxyPassReverse http://myserver.com/gitlab
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_URI} ^/uploads/.*
RewriteRule .* http://127.0.0.1:8181%{REQUEST_URI} [P,QSA,NE]
ErrorDocument 404 /404.html
ErrorDocument 422 /422.html
ErrorDocument 500 /500.html
ErrorDocument 502 /502.html
ErrorDocument 503 /503.html
</Location>
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
ErrorLog /var/log/httpd/logs/myserver_error.log
CustomLog /var/log/httpd/logs/myserver_forwarded.log common_forwarded
CustomLog /var/log/httpd/logs/myserver_access.log combined env=!dontlog
CustomLog /var/log/httpd/logs/myserver.log combined
</VirtualHost>