Etiket Arşivi apache2

Apache ssl virtualhost

Edit default-ssl configuration file;

<IfModule mod_ssl.c>

<VirtualHost _default_:443>
 ServerName blabla1.blabla.com:443
 ServerAdmin webmaster@localhost
 DocumentRoot /directory
 <Directory />
 Options FollowSymLinks
 AllowOverride None
 </Directory>
 <Directory /directory>
 Options FollowSymLinks MultiViews
 AllowOverride All
 Order allow,deny
 allow from all
 </Directory>

 ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
 <Directory "/usr/lib/cgi-bin">
 AllowOverride None
 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
 Order allow,deny
 Allow from all
 </Directory>

 ErrorLog /var/log/apache2/error.log

 LogLevel warn

 CustomLog /var/log/apache2/ssl_access.log combined

 Alias /doc/ "/usr/share/doc/"
 <Directory "/usr/share/doc/">
 Options Indexes MultiViews FollowSymLinks
 AllowOverride None
 Order deny,allow
 Deny from all
 Allow from 127.0.0.0/255.0.0.0 ::1/128
 </Directory>

 SSLEngine on

 SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
 SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
 #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt

 <FilesMatch "\.(cgi|shtml|phtml|php)$">
 SSLOptions +StdEnvVars
 </FilesMatch>
 <Directory /usr/lib/cgi-bin>
 SSLOptions +StdEnvVars
 </Directory>

 BrowserMatch "MSIE [2-6]" \
 nokeepalive ssl-unclean-shutdown \
 downgrade-1.0 force-response-1.0
 BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>

<VirtualHost _default_:443>
 ServerName blabla2.blabla.com:443
 ServerAdmin webmaster@localhost
 DocumentRoot /directory
 <Directory />
 Options FollowSymLinks
 AllowOverride None
 </Directory>
 <Directory /directory>
 Options FollowSymLinks MultiViews
 AllowOverride All
 Order allow,deny
 allow from all
 </Directory>

 ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
 <Directory "/usr/lib/cgi-bin">
 AllowOverride None
 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
 Order allow,deny
 Allow from all
 </Directory>

 ErrorLog /var/log/apache2/error.log
 LogLevel warn

 CustomLog /var/log/apache2/ssl_access.log combined
 Alias /doc/ "/usr/share/doc/"
 <Directory "/usr/share/doc/">
 Options Indexes MultiViews FollowSymLinks
 AllowOverride None
 Order deny,allow
 Deny from all
 Allow from 127.0.0.0/255.0.0.0 ::1/128
 </Directory>
 SSLEngine on
 SSLCertificateFile /directoryCert
 SSLCertificateKeyFile /directoryCertKeyFile


 <FilesMatch "\.(cgi|shtml|phtml|php)$">
 SSLOptions +StdEnvVars
 </FilesMatch>
 <Directory /usr/lib/cgi-bin>
 SSLOptions +StdEnvVars
 </Directory>

 BrowserMatch "MSIE [2-6]" \
 nokeepalive ssl-unclean-shutdown \
 downgrade-1.0 force-response-1.0
 BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

</VirtualHost>

 

(30.04.2019 tarihinden itibaren toplam 1 kez, bugün 1 kez ziyaret edildi. )

Belirli bir site hariç tüm istekleri 443’e yönlendirme

 ServerName blabla.com
 ServerAlias www.blabla.com
 RewriteEngine on

 RewriteCond %{HTTP_HOST} ^(www\.)?buharic.com [NC]
 RewriteRule ^ - [L]
 RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1

Yukarıdaki kural ile apache web sunucusuna gelen buharic.com haricinde gelen tüm istekler 443 portuna (https) yönlendirelecektir. Bu kural ile buharic.com isteği gelirse alttaki kurallar çalıştırılmayacak bu sayede yönlendirme yapılmayacaktır.

Ayrıca http://htaccess.madewithlove.be htaccess tester web sitesinden kurallarınızı test edebilirsiniz.

(30.04.2019 tarihinden itibaren toplam 11 kez, bugün 1 kez ziyaret edildi. )

Apache2 redirect subdomains http to https

Edit /etc/apache2/sites-available/000-default as;

ServerAdmin admin@domain.com
ServerName domain.com
ServerAlias www.domain.com
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

Source: https://www.digitalocean.com/community/questions/ubuntu-14-04-apache2-how-to-confi-https-and-subdomain

No visits yet