[GH-ISSUE #134] What wrong with my .htaccess? #93

Closed
opened 2026-02-26 02:32:06 +03:00 by kerem · 5 comments
Owner

Originally created by @vukidrock on GitHub (Dec 22, 2015).
Original GitHub issue: https://github.com/koel/koel/issues/134

Hi @phanan
When I try to install on nginx server (Digital Ocean VPS), it's OK, but when I try on Apache2 server, I can't install complete. I'm not sure what wrong so can you help me?

I set up Koel on subdirectory

/var/www/html/koel

The media folder at

/home/media

My Virtual host koel.conf here

<VirtualHost *:80>
        #ServerName localhost
        XSendFile On
        XSendFilePath /home/media
        DocumentRoot /var/www/html/koel
        <Directory /var/www/html/koel>
                DirectoryIndex index.html index.php
                Options FollowSymLinks
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

and .htaccess

<IfModule mod_headers.c>
    <FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff)$">
        Header set Access-Control-Allow-Origin "*"
    </FilesMatch>
</IfModule>

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

    RewriteEngine On
    RewriteBase /koel

    # Deny access to framework directories
    RewriteRule ^(app/|bootstrap/|config/|database/|resources/|storage/tests|vendor/) - [R=404,L,NC]

    # And dot files/folders (for example .env)
    RedirectMatch 404 /\..*$

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

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

<IfModule mod_deflate.c>
    # Disable deflation for media files.
    SetEnvIfNoCase Request_URI "^/api/play/" no-gzip dont-vary
</IfModule>

When I run npm install , sudo bower --allow-root install && gulp --production, and composer install, everything OK (I have updated many npm mod)

I edited .env file with database information, install phpmyadmin to create and view database
And finish with php artisan init

After that, I chmod storage folder with

sudo chown -R www-data storage
sudo chgrp -R www-data storage
sudo chmod -R 775 storage

When I type mywebsite.com/koel, the login form show up, but not show logo, the console error me

GET http://mywebsite/public/img/logo.svg 404 (Not Found)

and of courses when I click the login, website auto redirect me to

http://mywebsite/login

and show me

Not Found

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

When I move all of folder and file to /var/www/html it's OK but the song not play. I searched many issues, may be it's mod_rewrite and xsendfile error, I tried many ways but nothing happen.

Can you help me:

  • run koel on subdirectory
  • play songs

Thank you

Sorry for my English

Originally created by @vukidrock on GitHub (Dec 22, 2015). Original GitHub issue: https://github.com/koel/koel/issues/134 Hi @phanan When I try to install on nginx server (Digital Ocean VPS), it's OK, but when I try on Apache2 server, I can't install complete. I'm not sure what wrong so can you help me? I set up Koel on subdirectory ``` /var/www/html/koel ``` The media folder at ``` /home/media ``` My Virtual host koel.conf here ``` <VirtualHost *:80> #ServerName localhost XSendFile On XSendFilePath /home/media DocumentRoot /var/www/html/koel <Directory /var/www/html/koel> DirectoryIndex index.html index.php Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> ``` and .htaccess ``` <IfModule mod_headers.c> <FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff)$"> Header set Access-Control-Allow-Origin "*" </FilesMatch> </IfModule> <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On RewriteBase /koel # Deny access to framework directories RewriteRule ^(app/|bootstrap/|config/|database/|resources/|storage/tests|vendor/) - [R=404,L,NC] # And dot files/folders (for example .env) RedirectMatch 404 /\..*$ # Redirect Trailing Slashes... RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule> <IfModule mod_deflate.c> # Disable deflation for media files. SetEnvIfNoCase Request_URI "^/api/play/" no-gzip dont-vary </IfModule> ``` When I run `npm install` , `sudo bower --allow-root install && gulp --production`, and `composer install`, everything OK (I have updated many npm mod) I edited .env file with database information, install phpmyadmin to create and view database And finish with `php artisan init` After that, I chmod storage folder with ``` sudo chown -R www-data storage sudo chgrp -R www-data storage sudo chmod -R 775 storage ``` When I type `mywebsite.com/koel`, the login form show up, but not show logo, the console error me ``` GET http://mywebsite/public/img/logo.svg 404 (Not Found) ``` and of courses when I click the login, website auto redirect me to ``` http://mywebsite/login ``` and show me ``` Not Found The requested URL /login was not found on this server. ``` When I move all of folder and file to `/var/www/html` it's OK but the song not play. I searched many issues, may be it's mod_rewrite and xsendfile error, I tried many ways but nothing happen. Can you help me: - run koel on subdirectory - play songs Thank you Sorry for my English
kerem closed this issue 2026-02-26 02:32:06 +03:00
Author
Owner

@vukidrock commented on GitHub (Dec 22, 2015):

And error log show me this

[Mon Dec 21 23:00:39.860534 2015] [:error] [pid 23413] [client 117.3.36.204:55682] PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'There is no existing directory at "/var/www/html/koel/storage/logs" and its not buildable: Permission denied' in /var/www/html/koel/bootstrap/cache/compiled.php:13388\nStack trace:\n#0 /var/www/html/koel/bootstrap/cache/compiled.php(13340): Monolog\\Handler\\StreamHandler->createDir()\n#1 /var/www/html/koel/bootstrap/cache/compiled.php(13288): Monolog\\Handler\\StreamHandler->write(Array)\n#2 /var/www/html/koel/bootstrap/cache/compiled.php(13051): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n#3 /var/www/html/koel/bootstrap/cache/compiled.php(13147): Monolog\\Logger->addRecord(400, Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)\n#4 /var/www/html/koel/bootstrap/cache/compiled.php(12864): Monolog\\Logger->error(Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)\n#5 /var/www/html/koel/bootstrap/cache/compiled.php(12835): Illuminate\\Log\\Writer->writeLog('error', Object(Symfony\\Component\\Debug\\Exception\\FatalErrorE in /var/www/html/koel/bootstrap/cache/compiled.php on line 13388
<!-- gh-comment-id:166503351 --> @vukidrock commented on GitHub (Dec 22, 2015): And error log show me this ``` [Mon Dec 21 23:00:39.860534 2015] [:error] [pid 23413] [client 117.3.36.204:55682] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'There is no existing directory at "/var/www/html/koel/storage/logs" and its not buildable: Permission denied' in /var/www/html/koel/bootstrap/cache/compiled.php:13388\nStack trace:\n#0 /var/www/html/koel/bootstrap/cache/compiled.php(13340): Monolog\\Handler\\StreamHandler->createDir()\n#1 /var/www/html/koel/bootstrap/cache/compiled.php(13288): Monolog\\Handler\\StreamHandler->write(Array)\n#2 /var/www/html/koel/bootstrap/cache/compiled.php(13051): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n#3 /var/www/html/koel/bootstrap/cache/compiled.php(13147): Monolog\\Logger->addRecord(400, Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)\n#4 /var/www/html/koel/bootstrap/cache/compiled.php(12864): Monolog\\Logger->error(Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)\n#5 /var/www/html/koel/bootstrap/cache/compiled.php(12835): Illuminate\\Log\\Writer->writeLog('error', Object(Symfony\\Component\\Debug\\Exception\\FatalErrorE in /var/www/html/koel/bootstrap/cache/compiled.php on line 13388 ```
Author
Owner

@phanan commented on GitHub (Dec 22, 2015):

The error is obvious to me. Sorry I can't provide support down to this level.

<!-- gh-comment-id:166504587 --> @phanan commented on GitHub (Dec 22, 2015): The error is obvious to me. Sorry I can't provide support down to this level.
Author
Owner

@vukidrock commented on GitHub (Dec 22, 2015):

Can you suggest me some details ? I' ve never work with mod rewrite and xsendfile before.

<!-- gh-comment-id:166508950 --> @vukidrock commented on GitHub (Dec 22, 2015): Can you suggest me some details ? I' ve never work with mod rewrite and xsendfile before.
Author
Owner

@phanan commented on GitHub (Dec 22, 2015):

There is no existing directory at "/var/www/html/koel/storage/logs"

Create one then.

I' ve never work with mod rewrite and xsendfile before.

Google is your friend.

<!-- gh-comment-id:166521079 --> @phanan commented on GitHub (Dec 22, 2015): > There is no existing directory at "/var/www/html/koel/storage/logs" Create one then. > I' ve never work with mod rewrite and xsendfile before. Google is your friend.
Author
Owner

@ronilaukkarinen commented on GitHub (Dec 22, 2015):

@vukidrock See this.

<!-- gh-comment-id:166628733 --> @ronilaukkarinen commented on GitHub (Dec 22, 2015): @vukidrock See [this](https://github.com/phanan/koel/issues/74#issuecomment-165654315).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#93
No description provided.