The server configuration used to actually publish qemu-web.git to qemu.org together with the sphinx documentation, right now, is hidden in the machine that runs qemu.org.
Include it in the qemu-web.git website for documentation purpose, in the format of a Dockerfile that you can use to run your own qemu.org website. Note: this container is not yet in use, but it is already live and can be tested by adding 20.218.253.93 qemu.org www.qemu.org git.qemu.org qemu-project.org www.qemu-project.org git.qemu-project.org to your /etc/hosts file. Signed-off-by: Paolo Bonzini <[email protected]> --- container/Dockerfile | 6 ++++ container/README | 31 +++++++++++++++++++++ container/conf.d/git.conf | 13 +++++++++ container/conf.d/noname.conf | 11 ++++++++ container/conf.d/ssl.conf | 1 + container/conf.d/www.conf | 54 ++++++++++++++++++++++++++++++++++++ 6 files changed, 116 insertions(+) create mode 100644 container/Dockerfile create mode 100644 container/README create mode 100644 container/conf.d/git.conf create mode 100644 container/conf.d/noname.conf create mode 100644 container/conf.d/ssl.conf create mode 100644 container/conf.d/www.conf diff --git a/container/Dockerfile b/container/Dockerfile new file mode 100644 index 0000000..e22d646 --- /dev/null +++ b/container/Dockerfile @@ -0,0 +1,6 @@ +FROM quay.io/centos/centos:stream9 +EXPOSE 80 +RUN dnf install -y httpd-core mod_ssl +COPY conf.d /etc/httpd/conf.d +CMD /usr/sbin/httpd -DNO_DETACH -DFOREGROUND + diff --git a/container/README b/container/README new file mode 100644 index 0000000..ea764ff --- /dev/null +++ b/container/README @@ -0,0 +1,31 @@ +This is a Dockerfile for a container that serves the following hosts: + +- qemu.org, www.qemu.org: a proxy server that "hides" the fact that + the QEMU web pages are actually hosted as GitLab pages under either + qemu-project.gitlab.io/qemu (the documentation) or + qemu-project.gitlab.io/qemu-web (the main website) + +- git.qemu.org: a simple redirect to gitlab.com/qemu-project for + both web browsers and git's smart HTTP backend + + +A sample systemd service that publishes the website on port 8082 +is as follows: + +``` +[Unit] +Description=Podman instance control service for Apache proxy server +Requires=network.target +After=network.target +StartLimitIntervalSec=0 + +[Service] +Restart=always +ExecStartPre=-podman stop qemu-web ; -podman rm qemu-web +ExecStart=podman run --name qemu-web --publish=8082:80 qemu:qemu-web +ExecStop=podman stop -t 10 qemu-web +RestartSec=60 + +[Install] +WantedBy=default.target +``` diff --git a/container/conf.d/git.conf b/container/conf.d/git.conf new file mode 100644 index 0000000..13093c5 --- /dev/null +++ b/container/conf.d/git.conf @@ -0,0 +1,13 @@ +<VirtualHost *:80> + ServerName git.qemu.org + ServerAlias git.qemu.org + + RewriteEngine On + + RewriteRule ^/(git/)?([^/?;]+)\.git(/?|/HEAD|/info/.*|/objects/.*|/git-(upload|receive)-pack)$ http://gitlab.com/qemu-project/$2$3 [R,L] + RewriteRule ^/$ https://gitlab.com/qemu-project/ [R] + RewriteRule ^(/[^/?;]+\.git)$ https://gitlab.com/qemu-project/$1/ [R] + + Options -Indexes + +</VirtualHost> diff --git a/container/conf.d/noname.conf b/container/conf.d/noname.conf new file mode 100644 index 0000000..db17b95 --- /dev/null +++ b/container/conf.d/noname.conf @@ -0,0 +1,11 @@ +<VirtualHost *:80> + ServerName qemu.org + ServerAlias qemu.org + + RewriteEngine On + + RewriteRule ^(.*) https://www.qemu.org$0 [R=301] + + Options -Indexes + +</VirtualHost> diff --git a/container/conf.d/ssl.conf b/container/conf.d/ssl.conf new file mode 100644 index 0000000..b56a8a8 --- /dev/null +++ b/container/conf.d/ssl.conf @@ -0,0 +1 @@ +# do nothing, ssl is handled outside the container diff --git a/container/conf.d/www.conf b/container/conf.d/www.conf new file mode 100644 index 0000000..1904b5a --- /dev/null +++ b/container/conf.d/www.conf @@ -0,0 +1,54 @@ +<VirtualHost *:80> + ServerName www.qemu.org + ServerAlias www.qemu.org + + RewriteEngine On + RewriteRule ^/docs/master(/.*|$) https://qemu-project.gitlab.io/qemu$1 [NE,P,L] + Header edit Location ^(http:|https:)?//qemu-project\.gitlab\.io/qemu/ https://www.qemu.org/docs/master/ + + # Stable pointers within the documentation + RewriteRule /contribute/submit-a-patch/ /docs/master/devel/submitting-a-patch.html [R=302,L] + RewriteRule /contribute/submit-a-pull-request/ /docs/master/devel/submitting-a-pull-request.html [R=302,L] + RewriteRule /contribute/trivial-patches/ /docs/master/devel/trivial-patches.html [R=302,L] + + RewriteRule ^/(.*) https://qemu-project.gitlab.io/qemu-web/$1 [NE,P,L] + Header edit Location ^(http:|https:)?//qemu-project\.gitlab\.io/qemu-web/ https://www.qemu.org/ + + Options -Indexes + + RewriteEngine On + + SSLProxyEngine on + SSLProxyCheckPeerCN on + SSLProxyCheckPeerExpire on + + ProxyRequests Off + + DocumentRoot /var/www/html + Options -Indexes + + <Directory /var/www/html> + Options +FollowSymLinks + AllowOverride FileInfo + + FileETag All + </Directory> + + <Location /> + CacheDefaultExpire 600 + CacheMaxExpire 86400 + CacheLastModifiedFactor 0.5 + + Header merge Cache-Control public + </Location> + + <Location /assets> + ExpiresActive on + ExpiresDefault "access plus 1 week" + </Location> + <Location /screenshots> + ExpiresActive on + ExpiresDefault "access plus 1 week" + </Location> + +</VirtualHost> -- 2.40.1
