2017-10-16 167 views
1

我有一個基於Bonfire/Codeigniter的應用程序,功能齊全,沒有問題,可以通過HTTPS協議訪問。Bonfire/Codeigniter:可從HTTP訪問但不能從HTTPS訪問的文件夾

但是我有一個名爲應用,從外部篝火訪問文件夾,只有當訪問它HTTPSHTTP的作品,我收到一個404錯誤。從HTTP

Bonfire Root 
|_ application 
|_ bonfire 
|_ public 
| |_ app <--I can access it only over HTTP, no HTTPS. 
| |_ assets 
| |_ ... 
|_ tools 
|_ index.php 

訪問app文件夾:從HTTPS enter image description here

訪問app文件夾: enter image description here

下面是該文件的ssl.conf:

## ssl.conf ### 
<VirtualHost *:443> 
     ServerName developer.mydomain.com 
     DocumentRoot /var/www/html/mycompany/bonfire-root/public 
     ServerAlias developer.mydomain.com 
# Use separate log files for the SSL virtual host; note that LogLevel 
    ErrorLog logs/ssl_error_log_dev 
    TransferLog logs/ssl_access_log_dev 
    LogLevel warn 

    # SSL Engine Switch: 
    SSLEngine on 

    # List the protocol versions which clients are allowed to connect with. 
    SSLProtocol all -SSLv3 
    SSLProxyProtocol all -SSLv3 

    # User agents such as web browsers are not configured for the user's 
    SSLHonorCipherOrder on 

    # SSL Cipher Suite: 
    #SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM 
    #SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5 
    SSLCipherSuite HIGH:!aNULL:!MD5:!3DES:!CAMELLIA:!AES128 

    # Server Certificate and Keys: 
    SSLCertificateFile /etc/letsencrypt/live/***MY-DOMAIN***/fullchain.pem 
    SSLCertificateKeyFile /etc/letsencrypt/live/***MY-DOMAIN***/privkey.pem 

<IfModule mod_rewrite.c> 
     RewriteEngine On 

     # Enforce SSL https://www. 
     RewriteCond %{HTTPS} !=on 
     RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
     RewriteCond %{REQUEST_FILENAME} !-f 
     RewriteCond %{REQUEST_FILENAME} !-d 
     RewriteCond $1 !^(app\.php|assets|editor|css|js|scripts|templates|images|img|media|xml|user_guide|robots\.txt|favicon\.ico) 
     RewriteCond $1 !\.(css|js|jpe?g|gif|png|tiff|ttf|otf|woff|svg|mp3|mp4)$ 
     RewriteRule ^(.*)$ /index.php/$1 [L] 

    </IfModule> 

以下是文件httpd.conf:

## httpd.conf ### 
<VirtualHost *:80> 
    ServerName developer.mydomain.com 
    DocumentRoot /var/www/html/mycompany/bonfire-root/public 
    ServerAlias developer.mydomain.com 

    <Directory "/var/www/html/mycompany/developer"> 
     Options Indexes FollowSymLinks MultiViews 
     Options +FollowSymlinks -Indexes 
     AllowOverride All 
     Require all granted 
     Options FollowSymLinks 
     AllowOverride All 
     Order deny,allow 
     Allow from all 
    </Directory> 
</VirtualHost> 

下面是該文件的.htaccess:

## HTACCESS ## 
<IfModule mod_rewrite.c> 
    Options +FollowSymlinks 
    RewriteEngine On 

    RewriteCond %{REQUEST_URI} ^bonfire/codeigniter.* 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 


</IfModule> 

<IfModule mod_rewrite.c> 
    RewriteCond %{HTTPS} !=on 
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 
    RewriteRule^http://%1%{REQUEST_URI} [R=301,L] 
</IfModule> 

# Deny robots 
<IfModule mod_rewrite.c> 
    RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|Baiduspider|HTTrack) [NC] 
    RewriteRule .* - [R=403,L] 
</IfModule> 


# Checks to see if the user is attempting to access a valid file, 
# such as an image or css document, if this isn't true it sends the 
# request to index.php 

<IfModule mod_rewrite.c> 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 


<IfModule !mod_rewrite.c> 
    # If we don't have mod_rewrite installed, all 404's 
    # can be sent to index.php, and everything works as normal. 
    # Submitted by: ElliotHaughin 

    ErrorDocument 404 index.php 
</IfModule> 

我已經試過像從許多otrhers選項:

.htaccess mod_rewrite - how to exclude directory from rewrite rule

htaccess codeigniter mod-rewrite, rewritecond to ignore subdirectory within main app directory

我對這種配置的知識非常薄弱。也許有人可以很容易地幫助:D

回答

0

我可以看到的主要區別在於缺少ssl.conf中的DIRECTORY塊。嘗試從httpd.conf中複製它,或者將它移到VirtualHost之外。

相關問題