[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-omekas關於設定https":3},{"id":4,"slug":5,"title":6,"description":7,"content":8,"date":9,"image":10,"imageAlt":6,"author":11,"categories":14,"path":17,"minRead":18},32,"omekas關於設定https","[OmekaS]關於設定Https","關於設定Https 最近專案準備上了，順便紀錄一下掛載SSL時的設定。 Apache設定 Apache基本的S […]","\u003Ch2>關於設定Https\u003C\u002Fh2>\n\u003Cp>最近專案準備上了，順便紀錄一下掛載SSL時的設定。\u003C\u002Fp>\n\u003Ch3>Apache設定\u003C\u002Fh3>\n\u003Cp>Apache基本的SSL設定要開啟443，通常先設定\u003Cstrong>httpd-ssl.conf\u003C\u002Fstrong>之類的文檔，類似的教學與討論很多，就請自行找尋。範例如下。\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-php\">&lt;IfModule mod_ssl.c&gt;\n&lt;VirtualHost *:443&gt;\n    ServerAdmin webmaster@localhost\n    ServerName localhost\n    ServerAlias localhost\n    DocumentRoot \u002Fvar\u002Fwww\u002Fhtml\u002Fomeka\u002F\n\n    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,\n    # error, crit, alert, emerg.\n    # It is also possible to configure the loglevel for particular\n    # modules, e.g.\n    #LogLevel info ssl:warn\n\n    ErrorLog ${APACHE_LOG_DIR}\u002Ferror.log\n    CustomLog ${APACHE_LOG_DIR}\u002Faccess.log combined\n\n    # For most configuration files from conf-available\u002F, which are\n    # enabled or disabled at a global level, it is possible to\n    # include a line for only one particular virtual host. For example the\n    # following line enables the CGI configuration for this host only\n    # after it has been globally disabled with &quot;a2disconf&quot;.\n    #Include conf-available\u002Fserve-cgi-bin.conf\n\n    #   SSL Engine Switch:\n    #   Enable\u002FDisable SSL for this virtual host.\n    #啟動SSL\n    SSLEngine On\n\n    #   A self-signed (snakeoil) certificate can be created by installing\n    #   the ssl-cert package. See\n    #   \u002Fusr\u002Fshare\u002Fdoc\u002Fapache2\u002FREADME.Debian.gz for more info.\n    #   If both key and certificate are stored in the same file, only the\n    #   SSLCertificateFile directive is needed.\n\n    #這邊放pem與key\n    SSLCertificateFile     \u002Fetc\u002Fssl\u002Fcerts\u002Fssl-cert-snakeoil.pem\n    SSLCertificateKeyFile \u002Fetc\u002Fssl\u002Fprivate\u002Fssl-cert-snakeoil.key\n\n    #記得要設定訪問的資料夾位置與權限\n    &lt;Directory 你的網站資料夾位置&gt;\n            Options FollowSymLinks\n            AllowOverride All\n    &lt;\u002FDirectory&gt;\n            ErrorLog \u002Fvar\u002Flog\u002Fapache2\u002Fomeka-error_log\n            CustomLog \u002Fvar\u002Flog\u002Fapache2\u002Fomeka-access_log common\n    &lt;IfModule mod_headers.c&gt;\n    &lt;filesmatch &quot;\\.(html)$&quot;&gt;\n            Header set Cache-Control &quot;no-cache&quot;\n    &lt;\u002Ffilesmatch&gt;\n    &lt;\u002FIfModule&gt;\n\n&lt;\u002FVirtualHost&gt;\n&lt;\u002FIfModule&gt;\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3>OmekaS設定\u003C\u002Fh3>\n\u003Cp>然後要在OmekaS的資料夾中找到\u003Cstrong>htaccess \u003C\u002Fstrong>，加入以下設定。\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-php\">RewriteEngine On\n# Always redirect to https.\nRewriteCond %{HTTPS} !=on\nRewriteRule ^\u002F?(.*) https:\u002F\u002F%{SERVER_NAME}\u002F$1 [R,L]\u003C\u002Fcode>\u003C\u002Fpre>\n","2022-05-13T17:13:56","",{"name":12,"link":13},"Chih Fan","http:\u002F\u002Fpost.billxu.net",[15],{"name":16,"slug":16},"omekas","\u002Fblog\u002Fomekas關於設定https",2]