2017-09-17 16 views
0

今日、私は自分のサーバーで新しいプロジェクトを開始しました。私の見解では、すべて正しいものを設定していたと思います。しかし私の.htaccessは正しく動作していないか、無視されます。私はなぜそれが動作していないのかわかりません。問題は、書き換えURLに404が表示されるということです。apache2とlaravelで動作しないURLを書き換えます。

Laravel 5.0以降のプロジェクトはLarasocialを試してみます。 LarasocialはLaravel 5に基づいたソーシャルコミュニティです。

私はVhostsとHtaccessファイルをチェックしましたが、問題を正しく知ることはできません。また、service apache2 restartでApacheを再起動し、私のapache用にrewriteモジュールが有効になっているかどうかを調べてみてください。私はすべてが大丈夫だろうと思う。

私に手伝ってくれてありがとう!

これは私のVhostsとHtaccesssです。

<VirtualHost *:80> 
    # The ServerName directive sets the request scheme, hostname and port that 
    # the server uses to identify itself. This is used when creating 
    # redirection URLs. In the context of virtual hosts, the ServerName 
    # specifies what hostname must appear in the request's Host: header to 
    # match this virtual host. For the default virtual host (this file) this 
    # value is not decisive as it is used as a last resort host regardless. 
    # However, you must set it for any further virtual host explicitly. 
    ServerName integration.julian.droeger.rene-backhaus.de 

    ServerAdmin [email protected] 
    DocumentRoot /var/www/html/robot/customers/julian.droeger/integration/public 

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 
    # error, crit, alert, emerg. 
    # It is also possible to configure the loglevel for particular 
    # modules, e.g. 
    #LogLevel info ssl:warn 

    ErrorLog /home/robot/logs/customers/error.log 
    CustomLog /home/robot/logs/customers/access.log combined 

    # For most configuration files from conf-available/, which are 
    # enabled or disabled at a global level, it is possible to 
    # include a line for only one particular virtual host. For example the 
    # following line enables the CGI configuration for this host only 
    # after it has been globally disabled with "a2disconf". 
    #Include conf-available/serve-cgi-bin.conf 

     # Das folgende erzwingt SSL 
    #RewriteEngine On 
    #RewriteCond %{HTTPS} off 
    #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 
     <Directory /var/www/robot/customers/julian.droeger/integration/public> 
      #Options Indexes FollowSymLinks 
      AllowOverride All 
     #Require all granted 
     </Directory> 
RewriteEngine on 
RewriteCond %{SERVER_NAME} =rene-backhaus.de 
RewriteRule^https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent] 
</VirtualHost> 

SSL

<IfModule mod_ssl.c> 
<VirtualHost *:443> 
    # The ServerName directive sets the request scheme, hostname and port that 
    # the server uses to identify itself. This is used when creating 
    # redirection URLs. In the context of virtual hosts, the ServerName 
    # specifies what hostname must appear in the request's Host: header to 
    # match this virtual host. For the default virtual host (this file) this 
    # value is not decisive as it is used as a last resort host regardless. 
    # However, you must set it for any further virtual host explicitly. 
    ServerName integration.julian.droeger.rene-backhaus.de 

    ServerAdmin [email protected] 
    DocumentRoot /var/www/html/robot/customers/julian.droeger/integration/public/ 

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 
    # error, crit, alert, emerg. 
    # It is also possible to configure the loglevel for particular 
    # modules, e.g. 
    #LogLevel info ssl:warn 

    ErrorLog /home/robot/logs/customers/error.log 
    CustomLog /home/robot/logs/customers/access.log combined 

    # For most configuration files from conf-available/, which are 
    # enabled or disabled at a global level, it is possible to 
    # include a line for only one particular virtual host. For example the 
    # following line enables the CGI configuration for this host only 
    # after it has been globally disabled with "a2disconf". 
    #Include conf-available/serve-cgi-bin.conf 

     # Das folgende erzwingt SSL 
    #RewriteEngine On 
    #RewriteCond %{HTTPS} off 
    #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 
     <Directory /var/www/robot/customers/julian.droeger/integrationi/public> 
      #Options Indexes FollowSymLinks 
      AllowOverride All 
      #Require all granted 
    </Directory> 
RewriteEngine on 
# Some rewrite rules in this file were disabled on your HTTPS site, 
# because they have the potential to create redirection loops. 
# RewriteCond %{SERVER_NAME} =rene-backhaus.de 
# RewriteRule^https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent] 
SSLCertificateFile /etc/letsencrypt/live/rene-backhaus.de/fullchain.pem 
SSLCertificateKeyFile /etc/letsencrypt/live/rene-backhaus.de/privkey.pem 
Include /etc/letsencrypt/options-ssl-apache.conf 
</VirtualHost> 

htaccessの

</IfModule> 
<IfModule mod_rewrite.c> 
    <IfModule mod_negotiation.c> 
     Options -MultiViews 
    </IfModule> 

    RewriteEngine On 

    # Redirect Trailing Slashes... 
    RewriteRule ^(.*)/$ /$1 [L,R=301] 

    # Handle Front Controller... 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule^index.php [L] 
</IfModule> 

編集

Apacheのエラーログ:

[Sun Sep 17 12:42:35.463054 2017] [core:notice] [pid 6843] AH00094: Command line: '/usr/sbin/apache2' 
[Sun Sep 17 12:42:42.107113 2017] [mpm_prefork:notice] [pid 6843] AH00171: Graceful restart requested, doing restart 
[Sun Sep 17 12:42:42.153704 2017] [mpm_prefork:notice] [pid 6843] AH00163: Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured -- resuming normal operations 
[Sun Sep 17 12:42:42.153724 2017] [core:notice] [pid 6843] AH00094: Command line: '/usr/sbin/apache2' 
[Sun Sep 17 12:42:44.121750 2017] [mpm_prefork:notice] [pid 6843] AH00171: Graceful restart requested, doing restart 
[Sun Sep 17 12:42:44.163280 2017] [mpm_prefork:notice] [pid 6843] AH00163: Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured -- resuming normal operations 
[Sun Sep 17 12:42:44.163295 2017] [core:notice] [pid 6843] AH00094: Command line: '/usr/sbin/apache2' 
[Sun Sep 17 12:42:46.255223 2017] [mpm_prefork:notice] [pid 6843] AH00171: Graceful restart requested, doing restart 
[Sun Sep 17 12:42:46.301081 2017] [mpm_prefork:notice] [pid 6843] AH00163: Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured -- resuming normal operations 
[Sun Sep 17 12:42:46.301109 2017] [core:notice] [pid 6843] AH00094: Command line: '/usr/sbin/apache2' 

バーチャルホストアクセスログ:

79.214.162.134 - - [17/Sep/2017:12:44:02 +0200] "GET /fonts/glyphicons-halflings-regular.woff2 HTTP/1.1" 200 18377 "https://integration.thomas.walczak.rene-backhaus.de/css/libs.css" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" 
79.214.162.134 - - [17/Sep/2017:12:44:18 +0200] "GET /feeds HTTP/1.1" 404 725 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" 
79.214.162.134 - - [17/Sep/2017:12:44:18 +0200] "GET /favicon.ico HTTP/1.1" 404 593 "https://integration.thomas.walczak.rene-backhaus.de/feeds" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" 
79.214.162.134 - - [17/Sep/2017:13:58:26 +0200] "GET/HTTP/1.1" 200 6771 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" 
79.214.162.134 - - [17/Sep/2017:13:59:43 +0200] "GET/HTTP/1.1" 200 3664 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" 
79.214.162.134 - - [17/Sep/2017:13:59:51 +0200] "GET /feeds HTTP/1.1" 404 725 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" 
79.214.162.134 - - [17/Sep/2017:14:00:34 +0200] "GET /feeds HTTP/1.1" 404 725 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" 
79.214.162.134 - - [17/Sep/2017:14:00:35 +0200] "GET /feeds HTTP/1.1" 404 587 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" 
79.214.162.134 - - [17/Sep/2017:14:01:04 +0200] "GET /feeds HTTP/1.1" 404 725 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" 
79.214.162.134 - - [17/Sep/2017:14:01:05 +0200] "GET /feeds HTTP/1.1" 404 587 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" 

バーチャルホストのエラーログ:

[Sat Sep 16 22:57:22.509547 2017] [:error] [pid 30198] [client 217.238.62.18:64841] script '/var/www/html/robot/customers/julian.droeger/integration/status.php' not found or unable to stat 
[Sat Sep 16 22:57:23.156553 2017] [:error] [pid 30198] [client 217.238.62.18:64841] script '/var/www/html/robot/customers/julian.droeger/integration/remote.php' not found or unable to stat 
[Sat Sep 16 22:57:54.927797 2017] [:error] [pid 30191] [client 217.238.62.18:64850] script '/var/www/html/robot/customers/julian.droeger/integration/status.php' not found or unable to stat 
[Sat Sep 16 22:57:55.068064 2017] [:error] [pid 30191] [client 217.238.62.18:64850] script '/var/www/html/robot/customers/julian.droeger/integration/remote.php' not found or unable to stat 
[Sat Sep 16 22:58:26.504328 2017] [:error] [pid 30190] [client 217.238.62.18:64852] script '/var/www/html/robot/customers/julian.droeger/integration/status.php' not found or unable to stat 
[Sat Sep 16 22:58:26.614808 2017] [:error] [pid 30190] [client 217.238.62.18:64852] script '/var/www/html/robot/customers/julian.droeger/integration/remote.php' not found or unable to stat 
[Sat Sep 16 22:58:58.510322 2017] [:error] [pid 30197] [client 217.238.62.18:64853] script '/var/www/html/robot/customers/julian.droeger/integration/status.php' not found or unable to stat 
[Sat Sep 16 22:58:58.620842 2017] [:error] [pid 30197] [client 217.238.62.18:64853] script '/var/www/html/robot/customers/julian.droeger/integration/remote.php' not found or unable to stat 
[Sat Sep 16 22:59:30.507615 2017] [:error] [pid 30191] [client 217.238.62.18:64863] script '/var/www/html/robot/customers/julian.droeger/integration/status.php' not found or unable to stat 
[Sat Sep 16 22:59:30.639602 2017] [:error] [pid 30191] [client 217.238.62.18:64863] script '/var/www/html/robot/customers/julian.droeger/integration/remote.php' not found or unable to stat 
+0

Apacheログに表示されるエラーを表示できます。 –

答えて

0

このarticleが私のapache.confを見直した後Lesseonが...私は推測

を学びました。そして私はそこに何を見ますか? /var/wwwディレクトリでHtaccessが有効になっていません!今度は解決がかなり簡単だったので、AllowOverride NoneAllowOverride Allに変更しなければならなかった。 問題を修正しました。

しかし、私はすでに質問がありました。この記事の前に、Vhostの設定が重要な設定になると思っています。 AllowOverrideがVhostファイルのAllになっているので、apacheはこの設定をとります。なぜapache2にAllowOverride All設定がグローバルに必要なのですか?誰か説明することはできますか?

関連する問題