简体   繁体   中英

Laravel 5.1 on apache2 wont to start

Iadd laravel files into folder /var/www/html/laravel3 after that I change apache2.conf file I have:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/html/laravel3
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
...

but when I try http://mywebsite.com I get:

Not Found

The requested URL /auth/login was not found on this server.

Also I delete .htaccess file from /laravel3 folder

What to do now?

in apache2 I have:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

in sites-available/laravel.conf I have:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
    ServerName bedbids.com
        DocumentRoot "/var/www/html/laravel3/public"
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory "/var/www/html/laravel3/public">
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Do not remove the .htaccess file, it rewrites requests to the index.php .

For your apache config, the DocumentRoot should point to the public directory and you should set AllowOverride All , otherwise the htaccess is ignored.

This should work for you:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/html/laravel3/public
    <Directory /var/www/html/laravel3/public/>
            AllowOverride All
    </Directory>

    ...

After that change, restart apache and it should be up and running.

You should point Apache to a public directory inside Laravel root, for example:

DocumentRoot "/var/www/html/laravel3/public"
<Directory "/var/www/html/laravel3/public">

Also, you shouldn't edit or delete .htaccess .

After you made these changes, do not forget to reboot Apache.

Update

Original .htaccess :

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

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

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

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM