<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nino</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nino"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Nino"/>
	<updated>2026-04-30T08:25:14Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MediaWiki&amp;diff=27708</id>
		<title>MediaWiki</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MediaWiki&amp;diff=27708"/>
		<updated>2024-11-03T15:39:17Z</updated>

		<summary type="html">&lt;p&gt;Nino: Oversight from previous edit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.mediawiki.org/wiki/MediaWiki MediaWiki] is a popular free  web-based wiki software application developed by and used on all projects of the Wikimedia Foundation, as well as on many other wiki websites worldwide. It is written in the PHP programming language with a backend database.&lt;br /&gt;
&lt;br /&gt;
== Install lighttpd, PHP,  and postgresql ==&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add curl lighttpd php php-dom php-json php-pgsql php-cgi php-mbstring php-xml php-ctype php-fileinfo php-iconv php-zlib php-gd php-session php-intl imagemagick diffutils}}&lt;br /&gt;
&lt;br /&gt;
Install extra packages&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add postgresql postgresql-client openrc}}&lt;br /&gt;
&lt;br /&gt;
== Installing and configuring  MediaWiki ==&lt;br /&gt;
&lt;br /&gt;
Create a folder named {{Path|mediawiki}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkdir -p /usr/share/webapps/}}&lt;br /&gt;
&lt;br /&gt;
Download the [https://www.mediawiki.org/wiki/MediaWiki latest version]. At the time of writing it is 1.42.3&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cd /usr/share/webapps/&lt;br /&gt;
curl https://releases.wikimedia.org/mediawiki/1.42/mediawiki-1.42.3.tar.gz &amp;gt;mw.tar.gz}}&lt;br /&gt;
&lt;br /&gt;
Unpack the archive, rename the folder and delete the tarball afterwards&lt;br /&gt;
&lt;br /&gt;
{{Cmd|tar zxvf mw.tar.gz&lt;br /&gt;
mv mediawiki-1.42.3 mediawiki&lt;br /&gt;
rm mw.tar.gz}}&lt;br /&gt;
 &lt;br /&gt;
Change the folder permissions&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chown -R lighttpd /usr/share/webapps/}}&lt;br /&gt;
&lt;br /&gt;
Crate a symlink to the {{Path|mediawiki}} folder&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ln -s /usr/share/webapps/mediawiki/ /var/www/localhost/htdocs/mediawiki}}&lt;br /&gt;
&lt;br /&gt;
Edit lighttpd.conf and uncomment &#039;&#039;&#039;include &amp;quot;mod_fastcgi.conf&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{Cmd|vi /etc/lighttpd/lighttpd.conf}}&lt;br /&gt;
&lt;br /&gt;
== Starting ==&lt;br /&gt;
 &lt;br /&gt;
{{Cmd|rc-service postgresql setup&lt;br /&gt;
rc-service postgresql start &amp;amp;&amp;amp; rc-update add postgresql default&lt;br /&gt;
rc-service lighttpd start &amp;amp;&amp;amp; rc-update add lighttpd default}}&lt;br /&gt;
 &lt;br /&gt;
== Config your wiki ==&lt;br /&gt;
&lt;br /&gt;
Install the wiki accessing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;http://WEBSERVER_IP_ADDRESS/mediawiki/mw-config/index.php&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you finish, press &amp;quot;Install MediaWiki&amp;quot; button, and that&#039;s all. :)&lt;br /&gt;
You have MediaWiki working. To access go to &amp;lt;nowiki&amp;gt;http://WEBSERVER_IP_ADDRESS/mediawiki&amp;lt;/nowiki&amp;gt; and enjoy!&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
*[[Converting mediawiki database from postgresql to mysql/mariadb]]&lt;br /&gt;
&lt;br /&gt;
[[Category:SQL]]&lt;/div&gt;</summary>
		<author><name>Nino</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MediaWiki&amp;diff=27707</id>
		<title>MediaWiki</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MediaWiki&amp;diff=27707"/>
		<updated>2024-11-03T15:38:38Z</updated>

		<summary type="html">&lt;p&gt;Nino: Update mediawiki version and add missing requirement&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.mediawiki.org/wiki/MediaWiki MediaWiki] is a popular free  web-based wiki software application developed by and used on all projects of the Wikimedia Foundation, as well as on many other wiki websites worldwide. It is written in the PHP programming language with a backend database.&lt;br /&gt;
&lt;br /&gt;
== Install lighttpd, PHP,  and postgresql ==&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add curl lighttpd php php-dom php-json php-pgsql php-cgi php-mbstring php-xml php-ctype php-fileinfo php-iconv php-zlib php-gd php-session php-intl imagemagick diffutils}}&lt;br /&gt;
&lt;br /&gt;
Install extra packages&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add postgresql postgresql-client openrc}}&lt;br /&gt;
&lt;br /&gt;
== Installing and configuring  MediaWiki ==&lt;br /&gt;
&lt;br /&gt;
Create a folder named {{Path|mediawiki}}&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkdir -p /usr/share/webapps/}}&lt;br /&gt;
&lt;br /&gt;
Download the [https://www.mediawiki.org/wiki/MediaWiki latest version]. At the time of writing it is 1.42.3&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cd /usr/share/webapps/&lt;br /&gt;
curl https://releases.wikimedia.org/mediawiki/1.42/mediawiki-1.42.3.tar.gz &amp;gt;mw.tar.gz}}&lt;br /&gt;
&lt;br /&gt;
Unpack the archive, rename the folder and delete the tarball afterwards&lt;br /&gt;
&lt;br /&gt;
{{Cmd|tar zxvf mw.tar.gz&lt;br /&gt;
mv mediawiki-1.35.1 mediawiki&lt;br /&gt;
rm mw.tar.gz}}&lt;br /&gt;
 &lt;br /&gt;
Change the folder permissions&lt;br /&gt;
&lt;br /&gt;
{{Cmd|chown -R lighttpd /usr/share/webapps/}}&lt;br /&gt;
&lt;br /&gt;
Crate a symlink to the {{Path|mediawiki}} folder&lt;br /&gt;
&lt;br /&gt;
{{Cmd|ln -s /usr/share/webapps/mediawiki/ /var/www/localhost/htdocs/mediawiki}}&lt;br /&gt;
&lt;br /&gt;
Edit lighttpd.conf and uncomment &#039;&#039;&#039;include &amp;quot;mod_fastcgi.conf&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{{Cmd|vi /etc/lighttpd/lighttpd.conf}}&lt;br /&gt;
&lt;br /&gt;
== Starting ==&lt;br /&gt;
 &lt;br /&gt;
{{Cmd|rc-service postgresql setup&lt;br /&gt;
rc-service postgresql start &amp;amp;&amp;amp; rc-update add postgresql default&lt;br /&gt;
rc-service lighttpd start &amp;amp;&amp;amp; rc-update add lighttpd default}}&lt;br /&gt;
 &lt;br /&gt;
== Config your wiki ==&lt;br /&gt;
&lt;br /&gt;
Install the wiki accessing&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;http://WEBSERVER_IP_ADDRESS/mediawiki/mw-config/index.php&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you finish, press &amp;quot;Install MediaWiki&amp;quot; button, and that&#039;s all. :)&lt;br /&gt;
You have MediaWiki working. To access go to &amp;lt;nowiki&amp;gt;http://WEBSERVER_IP_ADDRESS/mediawiki&amp;lt;/nowiki&amp;gt; and enjoy!&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
*[[Converting mediawiki database from postgresql to mysql/mariadb]]&lt;br /&gt;
&lt;br /&gt;
[[Category:SQL]]&lt;/div&gt;</summary>
		<author><name>Nino</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Nginx_as_reverse_proxy_with_acme_(letsencrypt)&amp;diff=26788</id>
		<title>Talk:Nginx as reverse proxy with acme (letsencrypt)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Nginx_as_reverse_proxy_with_acme_(letsencrypt)&amp;diff=26788"/>
		<updated>2024-05-26T21:30:20Z</updated>

		<summary type="html">&lt;p&gt;Nino: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;acme-client is no longer in the repos - looks like its been replaced with acmetool. I assume by the same author? I&#039;m nowhere near experienced enough to refactor this page BUT the user guide (hlandau.github.io/acme/userguide) is pretty good, you set it up like so: &lt;br /&gt;
&lt;br /&gt;
acmetool quickstart&lt;br /&gt;
&lt;br /&gt;
and then:&lt;br /&gt;
&lt;br /&gt;
acmetool want example.com voidlinux.org&lt;br /&gt;
&lt;br /&gt;
(With your domains, d&#039;uh!) is a great way to get going - I found the proxy version worked quite well with just a few adjustments from the guides here. Hopefully someone with experience will fix this up. Alpine/nGinX is a blazing fast way to proxy HTTP/HTTPS to my hodge-podge of servers.[[User:Marcdraco|Marcdraco]] ([[User talk:Marcdraco|talk]]) 13:27, 24 May 2019 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that acme-client is now back in the repos, but it&#039;s a port of the OpenBSD fork (https://git.wolfsden.cz/acme-client-portable/about/) so the options on the page don&#039;t exists. Here&#039;s the man page: https://man.openbsd.org/acme-client.1[[User:Nino|Nino]] ([[User talk:Nino|talk]]) 21:30, 26 May 2024 (UTC)&lt;/div&gt;</summary>
		<author><name>Nino</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Nginx_as_reverse_proxy_with_acme_(letsencrypt)&amp;diff=26787</id>
		<title>Nginx as reverse proxy with acme (letsencrypt)</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Nginx_as_reverse_proxy_with_acme_(letsencrypt)&amp;diff=26787"/>
		<updated>2024-05-26T21:01:32Z</updated>

		<summary type="html">&lt;p&gt;Nino: /* SSL configuration */ Replace a dead link by a relevant one&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This setup will allow you to have multiple servers/containers accessible via a single IP address with the added benefit of a centralized generation of [https://letsencrypt.org/ letsencrypt] certificates and secure https (according to &#039;&#039;&#039;ssllabs ssltest&#039;&#039;&#039;). Be aware that you first need to setup a regular HTTP server in order to be able to generate your HTTPS certificates and keys. After you have generated them, you can then add your HTTPS host based configuration.&lt;br /&gt;
&lt;br /&gt;
See the [[Nginx|NGINX]] page for general information about Nginx, starting/stopping the service etc.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For this howto, we need three tools: [[Nginx|NGINX]], {{pkg|acme-client}} and {{pkg|openssl}} (to generate [https://wiki.openssl.org/index.php/Diffie-Hellman_parameters Diffie–Hellman Parameters]).&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk update&lt;br /&gt;
apk add nginx acme-client openssl}}&lt;br /&gt;
&lt;br /&gt;
== Setup ==&lt;br /&gt;
&lt;br /&gt;
=== NGINX HTTP ===&lt;br /&gt;
&lt;br /&gt;
==== Global configuration ====&lt;br /&gt;
&lt;br /&gt;
First step is to refactor our global &amp;lt;code&amp;gt;nginx.conf&amp;lt;/code&amp;gt;. Its target at a low traffic http server, to increase performance make changes at top level.&lt;br /&gt;
{{Cat|/etc/nginx/nginx.conf|&amp;lt;nowiki&amp;gt;# /etc/nginx/nginx.conf&lt;br /&gt;
&lt;br /&gt;
user nginx;&lt;br /&gt;
worker_processes 1; # use &amp;quot;auto&amp;quot; to use all available cores (high performance)&lt;br /&gt;
&lt;br /&gt;
# Configures default error logger.&lt;br /&gt;
error_log /var/log/nginx/error.log warn; # Log warn, error, crit, alert, emerg&lt;br /&gt;
&lt;br /&gt;
events {&lt;br /&gt;
    # The maximum number of simultaneous connections that can be opened by a worker process.&lt;br /&gt;
    worker_connections 1024; # increase if you need more connections&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
http {&lt;br /&gt;
    # server_names_hash_bucket_size controls the maximum length&lt;br /&gt;
    # of a virtual host entry (ie the length of the domain name).&lt;br /&gt;
    server_names_hash_bucket_size   64; # controls the maximum length of a virtual host entry (ie domain name)&lt;br /&gt;
    server_tokens                   off; # hide who we are, don&#039;t show nginx version to clients&lt;br /&gt;
    sendfile                        off; # can cause issues&lt;br /&gt;
&lt;br /&gt;
    # nginx will find this file in the config directory set at nginx build time&lt;br /&gt;
    # Includes mapping of file name extensions to MIME types of responses&lt;br /&gt;
    include mime.types;&lt;br /&gt;
&lt;br /&gt;
    # fallback in case we can&#039;t determine a type&lt;br /&gt;
    default_type application/octet-stream;&lt;br /&gt;
&lt;br /&gt;
    # buffering causes issues, disable it&lt;br /&gt;
    # increase buffer size. still useful even when buffering is off&lt;br /&gt;
    proxy_buffering off;&lt;br /&gt;
    proxy_buffer_size 4k;&lt;br /&gt;
&lt;br /&gt;
    # allow the server to close the connection after a client stops responding. Frees up socket-associated memory.&lt;br /&gt;
    reset_timedout_connection on;&lt;br /&gt;
&lt;br /&gt;
    # Specifies the main log format.&lt;br /&gt;
    log_format main &#039;$remote_addr - $remote_user [$time_local] &amp;quot;$request&amp;quot; &#039;&lt;br /&gt;
            &#039;$status $body_bytes_sent &amp;quot;$http_referer&amp;quot; &#039;&lt;br /&gt;
            &#039;&amp;quot;$http_user_agent&amp;quot; &amp;quot;$http_x_forwarded_for&amp;quot;&#039;;&lt;br /&gt;
&lt;br /&gt;
    # Sets the path, format, and configuration for a buffered log write.&lt;br /&gt;
    # Buffer log writes to speed up IO, or disable them altogether&lt;br /&gt;
    access_log /var/log/nginx/access.log main buffer=16k;&lt;br /&gt;
    #access_log off;&lt;br /&gt;
&lt;br /&gt;
    # include virtual hosts configs&lt;br /&gt;
    include conf.d/*.conf;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==== SSL configuration ====&lt;br /&gt;
&lt;br /&gt;
Configure a file with all SSL-parameters that we can include in the virtual hosts configs later on.&amp;lt;br&amp;gt;&lt;br /&gt;
The security settings are inspired by the [https://ssl-config.mozilla.org/#server=nginx&amp;amp;version=1.16.1&amp;amp;config=modern&amp;amp;openssl=1.1.1k&amp;amp;guideline=5.7 Mozilla SSL Configuration Generator]. Please also read https://hstspreload.org for details about HSTS.&lt;br /&gt;
{{Cat|/etc/nginx/conf.d/ssl-params.inc|&amp;lt;nowiki&amp;gt;# secure nginx, see https://ssl-config.mozilla.org&lt;br /&gt;
&lt;br /&gt;
ssl_protocols TLSv1.3&lt;br /&gt;
ssl_prefer_server_ciphers off;&lt;br /&gt;
ssl_session_timeout 1d;&lt;br /&gt;
ssl_session_cache shared:SSL:10m;&lt;br /&gt;
ssl_session_tickets off; # Requires nginx &amp;gt;= 1.5.9&lt;br /&gt;
ssl_stapling on; # Requires nginx &amp;gt;= 1.3.7&lt;br /&gt;
ssl_stapling_verify on; # Requires nginx =&amp;gt; 1.3.7&lt;br /&gt;
resolver 8.8.8.8 8.8.4.4 valid=300s;&lt;br /&gt;
resolver_timeout 5s;&lt;br /&gt;
&lt;br /&gt;
# https://hstspreload.org&lt;br /&gt;
add_header Strict-Transport-Security &amp;quot;max-age=63072000&amp;quot; always; &lt;br /&gt;
# By default, HSTS header is not added to subdomain requests. If you have subdomains and want&lt;br /&gt;
# HSTS to apply to all of them, you should add the includeSubDomains variable like this:&lt;br /&gt;
#add_header Strict-Transport-Security &amp;quot;max-age=63072000; includeSubDomains&amp;quot; always;&lt;br /&gt;
&lt;br /&gt;
add_header X-Frame-Options DENY;&lt;br /&gt;
add_header X-Content-Type-Options nosniff;&lt;br /&gt;
add_header X-XSS-Protection &amp;quot;1; mode=block&amp;quot;;&lt;br /&gt;
add_header X-Robots-Tag none;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==== Per site configuration files (conf.d) ====&lt;br /&gt;
&lt;br /&gt;
Since Alpine v3.5, we ship &#039;&#039;&#039;NGINX&#039;&#039;&#039; with a &amp;lt;code&amp;gt;default.conf&amp;lt;/code&amp;gt; within the {{path|/etc/nginx/conf.d}} directory.&lt;br /&gt;
&lt;br /&gt;
To add support for another website, you can add files with the &#039;&#039;&#039;.conf&#039;&#039;&#039; extension to this directory:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/nginx/conf.d/alpinelinux.org.conf|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
    listen        80;&lt;br /&gt;
    server_name   alpinelinux.org;&lt;br /&gt;
&lt;br /&gt;
    location / {&lt;br /&gt;
        include			conf.d/proxy_set_header.inc;&lt;br /&gt;
        proxy_pass		http://downstream_http_server_host;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==== Common configuration includes ====&lt;br /&gt;
&lt;br /&gt;
If you need to setup multiple proxy setups, you can include duplicated data such as shown below:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/nginx/conf.d/proxy_set_header.inc|&amp;lt;nowiki&amp;gt;proxy_set_header    X-Forwarded-By       $server_addr:$server_port;&lt;br /&gt;
proxy_set_header    X-Forwarded-For      $remote_addr;&lt;br /&gt;
proxy_set_header    X-Forwarded-Proto    $scheme;&lt;br /&gt;
proxy_set_header    Host                 $host;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== acme-client ===&lt;br /&gt;
To allow &#039;&#039;&#039;NGINX&#039;&#039;&#039; to support https, we need to add certificates and support for ACME (Automatic Certificate Management Environment) responses.&lt;br /&gt;
&lt;br /&gt;
==== ACME responses ====&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/nginx/conf.d/acme.inc|&amp;lt;nowiki&amp;gt;# Allow access to the ACME Challenge for Let&#039;s Encrypt&lt;br /&gt;
location ^~ /.well-known/acme-challenge {&lt;br /&gt;
    allow all;&lt;br /&gt;
    alias /var/www/acme;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
And add this to your proxy configuration:&lt;br /&gt;
{{Cat|/etc/nginx/conf.d/alpinelinux.org.conf|&amp;lt;nowiki&amp;gt;server {&lt;br /&gt;
    listen        80;&lt;br /&gt;
    server_name   alpinelinux.org;&lt;br /&gt;
    include       conf.d/acme.inc;&lt;br /&gt;
&lt;br /&gt;
    location / {&lt;br /&gt;
        include			conf.d/proxy_set_header.inc;&lt;br /&gt;
        proxy_pass		http://downstream_http_server_host;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==== Automatic generation of certificates ====&lt;br /&gt;
&lt;br /&gt;
Create the following file:&lt;br /&gt;
{{Cat|/etc/periodic/weekly/acme-client|&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
hosts=&amp;quot;alpinelinux.org&amp;quot;&lt;br /&gt;
&lt;br /&gt;
for host in $hosts; do&lt;br /&gt;
        acme-client -a https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf -Nnmv $host &amp;amp;&amp;amp; renew=1&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
[ &amp;quot;$renew&amp;quot; = 1 ] &amp;amp;&amp;amp; rc-service nginx reload&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Make it executable:&lt;br /&gt;
 chmod +x /etc/periodic/weekly/acme-client&lt;br /&gt;
&lt;br /&gt;
This script will run weekly to verify whether one of your certificates is outdated and renew them when needed.&lt;br /&gt;
&lt;br /&gt;
If you have several domains, you can add them to the &#039;&#039;&#039;hosts=&#039;&#039;&#039; variable with a space between each domain. This will create a separate certificate and key for each:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hosts=&amp;quot;alpinelinux.org example.com foo.org bar.io&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Initial generation of keys and certificates ====&lt;br /&gt;
&lt;br /&gt;
To create your initial certificates and keys, you have to run this manually the first time:&lt;br /&gt;
&lt;br /&gt;
 {{Cmd|/etc/periodic/weekly/acme-client}}&lt;br /&gt;
&lt;br /&gt;
Watch the output and see if all goes well. When it&#039;s finished, you should have files in:&lt;br /&gt;
&lt;br /&gt;
 /etc/ssl/acme/alpinelinux.nl/fullchain.pem&lt;br /&gt;
 /etc/ssl/acme/private/alpinelinux.org/privkey.pem&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== NGINX HTTPS ===&lt;br /&gt;
&lt;br /&gt;
==== Per site HTTPS configuration ====&lt;br /&gt;
&lt;br /&gt;
Add the following below the previous HTTP configuration:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/nginx/conf.d/alpinelinux.org.conf|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
    listen 443 ssl http2;&lt;br /&gt;
    listen [::]:443 ssl http2;&lt;br /&gt;
    server_name             alpinelinux.org&lt;br /&gt;
    ssl                     on;&lt;br /&gt;
    ssl_certificate         /etc/ssl/acme/alpinelinux.org/fullchain.pem;&lt;br /&gt;
    ssl_certificate_key     /etc/ssl/acme/private/alpinelinux.org/privkey.pem;&lt;br /&gt;
&lt;br /&gt;
    include /etc/nginx/conf.d/ssl-params.inc; # SSL parameters&lt;br /&gt;
&lt;br /&gt;
    location / {&lt;br /&gt;
        include     conf.d/proxy_set_header.inc;&lt;br /&gt;
        proxy_pass  http://downstream_http_server_host;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Redirect HTTP to HTTPS ===&lt;br /&gt;
&lt;br /&gt;
==== Shared configuration ====&lt;br /&gt;
&lt;br /&gt;
Create the following file:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/nginx/conf.d/redirect_http.inc|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
location / {&lt;br /&gt;
        return 301 https://$host$request_uri;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==== Update host configuration ====&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/nginx/conf.d/alpinelinux.org.conf|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
    listen        80;&lt;br /&gt;
    server_name   alpinelinux.org;&lt;br /&gt;
    include       conf.d/acme.inc;&lt;br /&gt;
    include       conf.d/redirect_http.inc;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Complete host example with IPv6 support ===&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/nginx/conf.d/alpinelinux.org.conf|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
    listen                  80;&lt;br /&gt;
    listen                  [::]:80;&lt;br /&gt;
    server_name             alpinelinux.org;&lt;br /&gt;
    include                 conf.d/acme.inc;&lt;br /&gt;
    include                 conf.d/redirect_http.inc;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
server {&lt;br /&gt;
    listen                  443 ssl http2;&lt;br /&gt;
    listen                  [::]:443 ssl http2;&lt;br /&gt;
    server_name             alpinelinux.org;&lt;br /&gt;
    ssl                     on;&lt;br /&gt;
    ssl_certificate         /etc/ssl/acme/alpinelinux.org/fullchain.pem;&lt;br /&gt;
    ssl_certificate_key     /etc/ssl/acme/private/alpinelinux.org/privkey.pem;&lt;br /&gt;
&lt;br /&gt;
    include /etc/nginx/conf.d/ssl-params.inc; # SSL parameters&lt;br /&gt;
&lt;br /&gt;
    location / {&lt;br /&gt;
        include     conf.d/proxy_set_header.inc;&lt;br /&gt;
        proxy_pass  http://downstream_http_server_host;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Authentication]]&lt;br /&gt;
[[Category:Networking]]&lt;br /&gt;
[[Category:Web Server]]&lt;/div&gt;</summary>
		<author><name>Nino</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Nginx&amp;diff=15272</id>
		<title>Nginx</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Nginx&amp;diff=15272"/>
		<updated>2018-06-17T12:39:09Z</updated>

		<summary type="html">&lt;p&gt;Nino: /* Controlling nginx */  Testing configuration before starting nginx will fail with `[emerg] open() &amp;quot;/run/nginx/nginx.pid&amp;quot; failed (2: No such file or directory)`&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://nginx.org/en/ Nginx] (engine x) is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Nginx package is available in the Alpine Linux repositories. To install it run:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk update&lt;br /&gt;
apk add nginx}}&lt;br /&gt;
&lt;br /&gt;
Creating new user and group &#039;www&#039; for nginx&lt;br /&gt;
{{Cmd|adduser -D -g &#039;www&#039; www}}&lt;br /&gt;
&lt;br /&gt;
Create a directory for html files&lt;br /&gt;
{{Cmd|mkdir /www&lt;br /&gt;
chown -R www:www /var/lib/nginx&lt;br /&gt;
chown -R www:www /www&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
You may want to make backup of original nginx.conf file before writting your own&lt;br /&gt;
{{Cmd|mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig}}&lt;br /&gt;
&lt;br /&gt;
Configuring Nginx to listen to port 80 and process .html or .htm files&lt;br /&gt;
{{Cmd|vi /etc/nginx/nginx.conf}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user                            www;&lt;br /&gt;
worker_processes                auto; # it will be determinate automatically by the number of core&lt;br /&gt;
&lt;br /&gt;
error_log                       /var/log/nginx/error.log warn;&lt;br /&gt;
#pid                             /var/run/nginx.pid; # it permit you to use /etc/init.d/nginx reload|restart|stop|start&lt;br /&gt;
&lt;br /&gt;
events {&lt;br /&gt;
    worker_connections          1024;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
http {&lt;br /&gt;
    include                     /etc/nginx/mime.types;&lt;br /&gt;
    default_type                application/octet-stream;&lt;br /&gt;
    sendfile                    on;&lt;br /&gt;
    access_log                  /var/log/nginx/access.log;&lt;br /&gt;
    keepalive_timeout           3000;&lt;br /&gt;
    server {&lt;br /&gt;
        listen                  80;&lt;br /&gt;
        root                    /www;&lt;br /&gt;
        index                   index.html index.htm;&lt;br /&gt;
        server_name             localhost;&lt;br /&gt;
        client_max_body_size    32m;&lt;br /&gt;
        error_page              500 502 503 504  /50x.html;&lt;br /&gt;
        location = /50x.html {&lt;br /&gt;
              root              /var/lib/nginx/html;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Sample page ==&lt;br /&gt;
{{Cmd|vi /www/index.html}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html lang=&amp;quot;en&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;meta charset=&amp;quot;utf-8&amp;quot; /&amp;gt;&lt;br /&gt;
    &amp;lt;title&amp;gt;HTML5&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
    Server is online&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Controlling nginx ==&lt;br /&gt;
&lt;br /&gt;
=== Start Nginx ===&lt;br /&gt;
After the installation Nginx is not running. To start Nginx, use &#039;&#039;start&#039;&#039;.&lt;br /&gt;
{{Cmd|rc-service nginx start}}&lt;br /&gt;
&lt;br /&gt;
You will get a feedback about the status.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * Caching service dependencies ...                     [ ok ]&lt;br /&gt;
 * /run/nginx: creating directory&lt;br /&gt;
 * /run/nginx: correcting owner                         &lt;br /&gt;
 * Starting nginx ...                                   [ ok ]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test configuration ===&lt;br /&gt;
When you&#039;ve made any changes to your nginx configuration files, you should check it for errors before restarting/reloading nginx.&amp;lt;br&amp;gt;&lt;br /&gt;
This will check for any duplicate configuration, syntax errors etc. To do this, run:&lt;br /&gt;
{{Cmd|nginx -t}}&lt;br /&gt;
&lt;br /&gt;
You will get a feedback if it failed or not. If everything is fine, you&#039;ll see the following and can then move ahead to reload the nginx server.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok&lt;br /&gt;
nginx: configuration file /etc/nginx/nginx.conf test is successful&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Reload and Restart Nginx ===&lt;br /&gt;
Changes made in the configuration file will not be applied until the command to reload configuration is sent to nginx or it is restarted.&amp;lt;br&amp;gt;&lt;br /&gt;
Reloading will do a &amp;quot;hot reload&amp;quot; of the configuration without server downtime. It will start the new worker processes with a new configuration and gracefully shutdown the old worker processes. If you have pending requests, then these will be handled by the old worker processes before it dies, so it&#039;s an extremely graceful way to reload configs.&lt;br /&gt;
If you want to reload the web server, use &#039;&#039;reload&#039;&#039;.&lt;br /&gt;
{{Cmd|rc-service nginx reload}}&lt;br /&gt;
If you want to restart the web server, use &#039;&#039;restart&#039;&#039;.&lt;br /&gt;
{{Cmd|rc-service nginx restart}}&lt;br /&gt;
&lt;br /&gt;
=== Stop Nginx ===&lt;br /&gt;
If you want to stop the web server, use &#039;&#039;stop&#039;&#039;.&lt;br /&gt;
{{Cmd|rc-service nginx stop}}&lt;br /&gt;
&lt;br /&gt;
=== Runlevel ===&lt;br /&gt;
Normally you want to start the web server when the system is launching. This is done by adding Nginx to the needed runlevel.&lt;br /&gt;
{{Cmd|rc-update add nginx default}}&lt;br /&gt;
&lt;br /&gt;
Now Nginx should start automatically when you boot your machine next time. To test that run:&lt;br /&gt;
{{cmd|reboot}}&lt;br /&gt;
&lt;br /&gt;
To make sure that Nginx is started run:&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;ps aux | grep nginx&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
You should get something like this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  263 root       0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf&lt;br /&gt;
  264 www        0:00 nginx: worker process&lt;br /&gt;
  310 root       0:00 grep nginx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing Nginx ==&lt;br /&gt;
This section is assuming that nginx is running and sample html page &amp;quot;/www/index.html&amp;quot; is created. Launch a web browser and point it to your web server.&lt;br /&gt;
You should get:&lt;br /&gt;
&amp;lt;pre&amp;gt;Server is online&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
If Nginx is not started check Nginx log file&lt;br /&gt;
{{cmd|less /var/log/nginx/error.log}}&lt;br /&gt;
&lt;br /&gt;
Make sure that configuration file does not contain errors. Edit the file in case there are any errors.&lt;br /&gt;
{{cmd|nginx -t&lt;br /&gt;
vi /etc/nginx/nginx.conf}}&lt;br /&gt;
&lt;br /&gt;
== Nginx with PHP ==&lt;br /&gt;
&lt;br /&gt;
[[Nginx_with_PHP#Nginx_with_PHP|Setting Up Nginx with PHP]] &amp;lt;br&amp;gt;&lt;br /&gt;
[[Nginx_as_reverse_proxy_with_acme_(letsencrypt)|Setting Up Nginx as Reverse Proxy with acme (Let&#039;s Encrypt)]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Web Server]]&lt;/div&gt;</summary>
		<author><name>Nino</name></author>
	</entry>
</feed>