[zamok] export apache2 + php custom configuration
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>certbot_on_virtu
							parent
							
								
									366190e007
								
							
						
					
					
						commit
						634369ad62
					
				| 
						 | 
					@ -3,6 +3,7 @@
 | 
				
			||||||
  apt:
 | 
					  apt:
 | 
				
			||||||
    update_cache: true
 | 
					    update_cache: true
 | 
				
			||||||
    name:
 | 
					    name:
 | 
				
			||||||
 | 
					      - apache2
 | 
				
			||||||
      - bat # Rajouté par shirenn le 10/11/2021
 | 
					      - bat # Rajouté par shirenn le 10/11/2021
 | 
				
			||||||
      - bitlbee  # Demande du 06/09/2017 17:40 sur #crans
 | 
					      - bitlbee  # Demande du 06/09/2017 17:40 sur #crans
 | 
				
			||||||
      - byobu
 | 
					      - byobu
 | 
				
			||||||
| 
						 | 
					@ -17,6 +18,7 @@
 | 
				
			||||||
      - inotify-tools  # Demande du 24/10/2017 23:17 sur #crans
 | 
					      - inotify-tools  # Demande du 24/10/2017 23:17 sur #crans
 | 
				
			||||||
      - jed  # Demande du 04/08/2017 sur nounou@
 | 
					      - jed  # Demande du 04/08/2017 sur nounou@
 | 
				
			||||||
      - joe
 | 
					      - joe
 | 
				
			||||||
 | 
					      - libapache2-mod-fcgid
 | 
				
			||||||
      - libapache2-mod-wsgi-py3
 | 
					      - libapache2-mod-wsgi-py3
 | 
				
			||||||
      - lua-cjson  # Demande du 01/09/2017 18:50 sur #crans
 | 
					      - lua-cjson  # Demande du 01/09/2017 18:50 sur #crans
 | 
				
			||||||
      - lynx  # Demande du 30/07/2017 sur nounou@
 | 
					      - lynx  # Demande du 30/07/2017 sur nounou@
 | 
				
			||||||
| 
						 | 
					@ -28,7 +30,15 @@
 | 
				
			||||||
      - par
 | 
					      - par
 | 
				
			||||||
      - pdftk  # Demande mail nounou@ 16/10/2018 16h01
 | 
					      - pdftk  # Demande mail nounou@ 16/10/2018 16h01
 | 
				
			||||||
      - php
 | 
					      - php
 | 
				
			||||||
 | 
					      - php-bz2
 | 
				
			||||||
 | 
					      - php-curl
 | 
				
			||||||
 | 
					      - php-fpm
 | 
				
			||||||
 | 
					      - php-gd
 | 
				
			||||||
 | 
					      - php-mbstring
 | 
				
			||||||
      - php-mysql
 | 
					      - php-mysql
 | 
				
			||||||
 | 
					      - php-sqlite
 | 
				
			||||||
 | 
					      - php-xml
 | 
				
			||||||
 | 
					      - php-zip
 | 
				
			||||||
      - phpmyadmin
 | 
					      - phpmyadmin
 | 
				
			||||||
      - pkg-config  # Demande du 01/02/2018 15:00 sur #roots
 | 
					      - pkg-config  # Demande du 01/02/2018 15:00 sur #roots
 | 
				
			||||||
      - poppler-utils
 | 
					      - poppler-utils
 | 
				
			||||||
| 
						 | 
					@ -59,3 +69,39 @@
 | 
				
			||||||
  register: apt_result
 | 
					  register: apt_result
 | 
				
			||||||
  retries: 3
 | 
					  retries: 3
 | 
				
			||||||
  until: apt_result is succeeded
 | 
					  until: apt_result is succeeded
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Install required apache modules
 | 
				
			||||||
 | 
					  community.general.apache2_module:
 | 
				
			||||||
 | 
					    name: "{{ item }}"
 | 
				
			||||||
 | 
					    state: present
 | 
				
			||||||
 | 
					  loop:
 | 
				
			||||||
 | 
					    - authz_groupfile
 | 
				
			||||||
 | 
					    - proxy
 | 
				
			||||||
 | 
					    - proxy_fcgi
 | 
				
			||||||
 | 
					    - proxy_http
 | 
				
			||||||
 | 
					    - rewrite
 | 
				
			||||||
 | 
					    - socache_shmcb
 | 
				
			||||||
 | 
					    - userdir
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Copy apache configuration
 | 
				
			||||||
 | 
					  template:
 | 
				
			||||||
 | 
					    src: "apache2/{{ item }}.j2"
 | 
				
			||||||
 | 
					    dest: "/etc/apache2/{{ item }}"
 | 
				
			||||||
 | 
					    owner: root
 | 
				
			||||||
 | 
					    group: root
 | 
				
			||||||
 | 
					    mode: 0644
 | 
				
			||||||
 | 
					  loop:
 | 
				
			||||||
 | 
					    - "club-vhosts.map"
 | 
				
			||||||
 | 
					    - "ports.conf"
 | 
				
			||||||
 | 
					    - "sites-available/000-perso-vhosts.conf"
 | 
				
			||||||
 | 
					    - "sites-available/001-perso.conf"
 | 
				
			||||||
 | 
					    - "suexec/www-data"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: Enable apache sites
 | 
				
			||||||
 | 
					  file:
 | 
				
			||||||
 | 
					    src: "/etc/apache2/sites-available/{{ item }}"
 | 
				
			||||||
 | 
					    dest: "/etc/apache2/sites-enabled/{{ item }}"
 | 
				
			||||||
 | 
					    owner: root
 | 
				
			||||||
 | 
					    group: root
 | 
				
			||||||
 | 
					    state: link
 | 
				
			||||||
 | 
					    force: true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,4 @@
 | 
				
			||||||
 | 
					pot-vieux.crans.org club-vieux/www
 | 
				
			||||||
 | 
					med.crans.org club-med/www
 | 
				
			||||||
 | 
					www.scepinvaders.com waltsburger/www
 | 
				
			||||||
 | 
					scepinvaders.com waltsburger/www
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,10 @@
 | 
				
			||||||
 | 
					# If you just change the port or add more ports here, you will likely also
 | 
				
			||||||
 | 
					# have to change the VirtualHost statement in
 | 
				
			||||||
 | 
					# /etc/apache2/sites-enabled/000-default.conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Listen 127.0.0.1:80
 | 
				
			||||||
 | 
					Listen 172.16.10.31:80
 | 
				
			||||||
 | 
					Listen 185.230.79.1:80
 | 
				
			||||||
 | 
					#Listen [2a0c:700:0:24:1e98:ecff:fe15:2c88]:80
 | 
				
			||||||
 | 
					#Listen [2a0c:700:0:2:1e98:ecff:fe15:2c88]:80
 | 
				
			||||||
 | 
					# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,25 @@
 | 
				
			||||||
 | 
					# Configuration des vhosts personnalises
 | 
				
			||||||
 | 
					# Ce fichier doit etre le premier dans sites-enabled
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<VirtualHost *:80>
 | 
				
			||||||
 | 
					    # Le nom du serveur est determine a partir de la requete HTTP
 | 
				
			||||||
 | 
					    UseCanonicalName Off
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Logs
 | 
				
			||||||
 | 
					    LogFormat "%{Host}i %h %l %u %t \"%r\" %s %b" vcommon
 | 
				
			||||||
 | 
					    CustomLog /var/log/apache2/perso-vhosts.log vcommon
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # On charge le fichier mappant les vhosts clubs
 | 
				
			||||||
 | 
					    # puis on rewrite si seulement s'il y a un match
 | 
				
			||||||
 | 
					    RewriteEngine On
 | 
				
			||||||
 | 
					    RewriteMap clubs-vhost txt:/etc/apache2/clubs-vhosts.map
 | 
				
			||||||
 | 
					    RewriteCond ${clubs-vhost:%{SERVER_NAME}} ^(.+)$
 | 
				
			||||||
 | 
					    RewriteRule ^/(.*)$ /home/%1/$1 [last]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Override defaults in /etc/apache2/mods-enabled/userdir.conf
 | 
				
			||||||
 | 
					    # to add Indexes control in .htaccess and README
 | 
				
			||||||
 | 
					    <Directory /home/*/www>
 | 
				
			||||||
 | 
					        AllowOverride FileInfo AuthConfig Limit Indexes Options=Indexes
 | 
				
			||||||
 | 
					        ReadmeName /mentionslegales.html
 | 
				
			||||||
 | 
					    </Directory>
 | 
				
			||||||
 | 
					</VirtualHost>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,34 @@
 | 
				
			||||||
 | 
					<VirtualHost *:80>
 | 
				
			||||||
 | 
					    ServerName perso.crans.org
 | 
				
			||||||
 | 
					    DocumentRoot /var/www/perso/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Quelques redirections
 | 
				
			||||||
 | 
					    RewriteEngine On
 | 
				
			||||||
 | 
					    RewriteRule ^/phpmyadmin/?(.*)$ /usr/share/phpmyadmin/$1 [last]
 | 
				
			||||||
 | 
					    RewriteRule ^/icons/(.*)$ /usr/share/apache2/icons/$1 [last]
 | 
				
			||||||
 | 
					    RewriteRule ^/$ https://wiki.crans.org/PagesPerso [last,redirect]
 | 
				
			||||||
 | 
					    RewriteRule ^/~(.*)$ https://perso.crans.org/$1 [last,redirect]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # On aime la magie noire ici.
 | 
				
			||||||
 | 
					    # Plus sérieusement, on aime beaucoup mod_userdir, mais on ne veut
 | 
				
			||||||
 | 
					    # pas insérer un '~' avant le pseudo. Donc on réécrit l'URL.
 | 
				
			||||||
 | 
					    # Toute personne qui tente de réécrire mod_userdir à coup de RewriteRule
 | 
				
			||||||
 | 
					    # s'aventure dans un monde chaotique, et PHP ne tournera plus en tant
 | 
				
			||||||
 | 
					    # que chaque utilisateur menant à des fuites de données.
 | 
				
			||||||
 | 
					    RewriteRule ^/users/(.*)$ /~$1 [last,passthrough]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Si ça match un utilisateur, on sert sa page personnelle
 | 
				
			||||||
 | 
					    RewriteRule ^/([^~/]+)/(.*)$ /home/$1/www/$2 [last]
 | 
				
			||||||
 | 
					    RewriteRule ^/([^~/]+)$ /home/$1/www/ [last]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Log à part
 | 
				
			||||||
 | 
					    CustomLog /var/log/apache2/perso.log combined
 | 
				
			||||||
 | 
					    ErrorLog /var/log/apache2/perso.error.log
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Override defaults in /etc/apache2/mods-enabled/userdir.conf
 | 
				
			||||||
 | 
					    # to add Indexes control in .htaccess and README
 | 
				
			||||||
 | 
					    <Directory /home/*/www>
 | 
				
			||||||
 | 
					        AllowOverride FileInfo AuthConfig Limit Indexes Options=Indexes
 | 
				
			||||||
 | 
					        ReadmeName /mentionslegales.html
 | 
				
			||||||
 | 
					    </Directory>
 | 
				
			||||||
 | 
					</VirtualHost>
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,8 @@
 | 
				
			||||||
 | 
					/var/www
 | 
				
			||||||
 | 
					www
 | 
				
			||||||
 | 
					# The first two lines contain the suexec document root and the suexec userdir
 | 
				
			||||||
 | 
					# suffix. If one of them is disabled by prepending a # character, suexec will
 | 
				
			||||||
 | 
					# refuse the corresponding type of request.
 | 
				
			||||||
 | 
					# This config file is only used by the apache2-suexec-custom package. See the
 | 
				
			||||||
 | 
					# suexec man page included in the package for more details.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue