WAS/Apache

VirtualHost, SSL, Rewrite

Lawmin 2023. 7. 11. 11:55

<VirtualHost *:80>
    DocumentRoot "/var/www/html/"
    ServerName 도메인:80
    ErrorLog "/var/log/httpd/error_log"
    TransferLog "/var/log/httpd/access_log"
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !^(.*).(ico|png|js|jpg|css|gif)$
    RewriteCond %{REQUEST_URI} !^/index.html$ [NC]
    RewriteRule . index.html [R=302,L]
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot "/var/www/html/"
    ServerName 도메인:443
    ErrorLog "/var/log/httpd/ssl_error_log"
    TransferLog "/var/log/httpd//ssl_access_log"
    SSLEngine on
    SSLCertificateFile          "/etc/httpd/conf.d/ssl/cert.crt"
    SSLCertificateKeyFile       "/etc/httpd/conf.d/ssl/cert.key"
    SSLCACertificateFile        "/etc/httpd/conf.d/ssl/chainca.crt"
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !^(.*).(ico|png|js|jpg|css|gif)$
    RewriteCond %{REQUEST_URI} !^/index.html$ [NC]
    RewriteRule . index.html [R=302,L]
</VirtualHost>