====== Apache et Virtual Hosts ====== [[http://httpd.apache.org/docs/2.2/fr/vhosts/examples.html| Virtual hosts]] ====== Créer son certificat SSL ====== Utilisez certbot sous windows: [[https://certbot.eff.org/lets-encrypt/windows-apache]] . Installer certbot sur c:\Certbot (dites ok a l'anti virus...) . Ouvrer une commande dos en mode admin . Arreter le serveur web . Executer dans la cmd admin: certbot certonly --standalone . Donner une adresse mail (exemple: moi@tm.eu ) . Dites Y pour les conitions . Dites N pour l'envoi de votre mail . Donnez votre site web: www.leo-stitch.com par exemple . Récupérer vos fichiers: Congratulations! Your certificate and chain have been saved at: C:\Certbot\live\www.leo-stitch.com\fullchain.pem Your key file has been saved at: C:\Certbot\live\www.leo-stitch.com\privkey.pem Your certificate will expire on 2021-04-07. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew *all* of your certificates, run "certbot renew" ====== Installer son certificat SSL dans apache windows ====== . [[https://www.veremes.com/configuration-ssl-apache]] . Lancer le module ssl d'apache (Façon simple par le clic sur l'icone en bas a droite de wampserver puis Apache->Module Apache->Ssl module (scrollez si nécessaire...)) . Editer C:\serveurs\Apache24\conf\httpd.conf (Faites une copie avant...) . Dé-commenter les lignes (enlever le « # ») suivantes : . LoadModule ssl_module modules/mod_ssl.so . LoadModule socache_shmcb_module modules/mod_socache_shmcb.so . Include conf/extra/httpd-ssl.conf ====== SSL multi adresse web ====== Si vous avez deux sites (ou plus) sur le même serveur, certbot ne sert à rien. Il faut générer les certificats soi-même. le64.exe --key account-key.key --email "admin@example.com" --csr www.example.com.csr --csr-key www.example.com.key --domains "www.example.com" -generate-missing --generate-only cd PathToWebRoot\example.www\ mkdir .well-known cd .well-known mkdir acme-challenge cd pathTole64 le64.exe --key account-key.key --email "admin@example.com" --csr www.example.com.csr --crt www.example.com.crt --generate-missing --unlink --path "PathToWebRoot\example.www\.well-known\acme-challenge" --live Puis tester pour renouveler le certificat: le64.exe --key account-key.key --email "admin@example.com" --csr www.example.com.csr --csr-key www.example.com.key --crt www.example.com.crt --domains "www.example.com" --unlink --path "PathToWebRoot\example.www\.well-known\acme-challenge" --live --renew 21 --issue-code 100 ====== SSL 443 ====== LoadModule ssl_module modules/mod_ssl.so Listen 443 ServerName www.example.com Redirect / https://www.example.com:443/ ServerName www.example2.com Redirect / https://www.example2.com:443/ ServerName www.example.com SSLEngine on SSLCertificateFile "/path/to/www.example.com.cert" SSLCertificateKeyFile "/path/to/www.example.com.key" ServerName www.example2.com SSLEngine on SSLCertificateFile "/path/to/www.example2.com.cert" SSLCertificateKeyFile "/path/to/www.example2.com.key" ====== Apache et Tomcat: Php et JSP sur le meme domaine ====== Installer tomcat facilement sur windows avec:\\ 32-bit/64-bit Windows Service Installer (pgp, md5)\\ Le couple apache/php fonctionne bien mais si vous avez de vieux sites en php et que vous voulez profiter de la puissance et de la simplicite de vaadin pour faire des sites en ajax, vous voulez surement un site qui supporte du php et du java.\\ \\ Il faut installer un apache avec du php sur le port 80. \\ Il faut installer un tomcat sur le port 8080 (installation par defaut).\\ Ensuite, il suffit de les relier. \\ Pour cela, il faut utiliser le connecteur: mod_jk. Sur unix, il faut telecharger les sources et le recompiler. Sur windows, il existe tout fait.\\ Ensuite il faut pour tomcat ajouter une ligne dans conf/server.xml (ou verifier qu'elle est bien presente et non commentee): Et on redemarre tomcat...\\ \\ Pour apache, il faut modifier http.conf et creer un fichier workers.properties.\\ \\ Sur une solaris ca donne ceci:\\ # Load mod_jk module # Update this path to match your modules location LoadModule jk_module libexec/mod_jk.so # Where to find workers.properties # Update this path to match your conf directory location (put workers.properties next to httpd.conf) JkWorkersFile /etc/apache2/workers.properties # Where to put jk shared memory # Update this path to match your local state directory or logs directory JkShmFile /var/apache2/logs/mod_jk.shm # Where to put jk logs # Update this path to match your logs directory location (put mod_jk.log next to access_log) JkLogFile /var/apache2/logs/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info # Select the timestamp log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # Send everything for context /examples to worker named worker1 (ajp13) JkMount /examples/* worker1 JkMount /examples worker1 JkMount /docs/* worker1 JkMount /docs worker1 JkMountCopy On A noter: . http.conf se trouve dans /etc/apache2/http.conf (sur solaris 10) . mod_jk.so a ete copie dans /usr/apache2/libexec/mod_jk.so avec les bons droits. . Les JkMount permettent de dire a apache quels sont les repertoires geres par tomcat: examples et docs dans cet exemple. Il faut creer le fichier workers.properties (pour solaris 10 dans /etc/apache2/workers.properties): # Define 1 real worker using ajp13 workers.tomcat_home=/usr/local/tomcat/apache-tomcat-7.0.26 <- mon path ou se trouve tomcat = TOMCAT_HOME workers.java_home=/usr/jdk/jdk1.6.0_21 <- JAVA_HOME worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=1 Ensuite il faut essayer: . http://localhost . http://localhost/examples . http://localhost/docs . http://localhost:8080 ====== Certificat localhost ssl self - signed ====== openssl req -config openssl.cnf -new -out www.tmburo.com.csr -keyout www.tmburo.com.pem openssl rsa -in www.tmburo.com.pem -out www.tmburo.com.key openssl x509 -in www.tmburo.com.csr -out www.tmburo.com.cert -req -signkey www.tmburo.com.key -days 365 rem https://stackoverflow.com/questions/4221874/how-do-i-allow-https-for-apache-on-localhost rem SSLSessionCache "shmcb:C:/Progra\~2/Zend/Apache2/logs/ssl_scache(512000)" rem LoadModule socache_shmcb_module modules/mod_socache_shmcb.so – erik Sep 21 '16 at 11:33 rem LoadModule ssl_module modules/mod_ssl.so rem Include conf/extra/httpd-ssl.conf rem DocumentRoot - set this to the folder for your web files rem ServerName - the server's hostname rem SSLCertificateFile "conf/www.tmburo.com.cert" rem SSLCertificateKeyFile "conf/www.tmburo.com.key"