Multiple Sites on Single Hostname
Example to setup 2 sites on Single Host
Setup GerritReview
- Edit a gerrit.conf in /etc/apache2/sites-available
vim /etc/apache2/sites-available/gerrit.conf
Example:
<virtualhost *:80>
servername example.com
ProxyPreserveHost On
ProxyPass /gerrit http://localhost:8082/gerrit
ProxyPassReverse /gerrit http://localhost:8082/gerrit
ProxyPassReverseCookiePath /gerrit /gerrit
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /gerrit/login/>
AuthType Basic
AuthName "Gerrit Code Review"
Require valid-user
AuthBasicProvider file
AuthUserFile /mnt/a/app/gerrit/pwd
</Location>
</virtualhost>
- Configurate the Gerrit Review check gerrit/etc/gerrit.config
[gerrit]
basePath = /mnt/a/repos
canonicalWebUrl = http://example.com/gerrit
serverId = aafe2a2f-41cc-44da-be9b-43efe61b3d5f
[container]
javaOptions = "-Dflogger.backend_factory=com.google.common.flogger.backend.log4j.Log4jBackendFactory#getInstance"
javaOptions = "-Dflogger.logging_context=com.google.gerrit.server.logging.LoggingContext#getInstance"
user = cfei
javaHome = /usr/lib/jvm/java-11-openjdk-amd64
[index]
type = lucene
[auth]
type = HTTP
[receive]
enableSignedPush = true
[sendemail]
smtpServer = localhost
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = http://*:8082/gerrit
[cache]
directory = cache
Setup GitBucket
Suppose to access GitBucket at http://example.com/gitbucket
- Edit a gitbucket.conf in /etc/apache2/sites-available
vim /etc/apache2/sites-available/gitbucket.conf
Example:
<VirtualHost *:80>
ServerName gitbucket.example.com
# proxy
proxypreservehost on
proxypass /gitbucket http://localhost:8080/gitbucket/
proxypassreverse /gitbucket http://localhost:8080/gitbucket/
proxypassreversecookiepath /gitbucket /gitbucket
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
- Run gitbucket
nohup java -jar gitbucket.war --port=8080 --hostname=example.com --gitbucket.home=/mnt/a/data/gitbucket --prefix=gitbucket > /mnt/a/data/gitbucket/log>&1 &