Kerwood / Rtorrent-Auto-Install

Auto install script for rtorrent with Rutorrent as GUI.
259 stars 109 forks source link

403 Forbidden #125

Closed dausruddin closed 9 years ago

dausruddin commented 9 years ago

Regarding this question answered => https://github.com/Kerwood/rtorrent.auto.install/issues/121

I installed rutorrent on my Ubuntu 14.04 with virtualmin installed. Now I have 2 issues so far. First, php doesnt work on /var/www/rutorrent. So I modified rutorrent.conf to enable php. Then now I got a new problem.

[17.10.2015 12:32:18] WebUI started.
[17.10.2015 12:32:19] Bad response from server: (403 [error,getplugins]) <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>403 Forbidden</title> </head><body> <h1>Forbidden</h1> <p>You don't have permission to access /rutorrent/php/getplugins.php on this server.</p> </body></html>
[17.10.2015 12:32:19] Bad response from server: (403 [error,getuisettings]) <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>403 Forbidden</title> </head><body> <h1>Forbidden</h1> <p>You don't have permission to access /rutorrent/php/getsettings.php on this server.</p> </body></html>

/var/www/rutorrent already chowned recursively to www-data. I dont know what is the problem.

This is error apache2 error log

localhost:80 xxx.xxx.xxx.xxx - myuser [17/Oct/2015:12:32:19 +0800] "POST /rutorrent/php/getsettings.php HTTP/1.1" 403 437 "http://example.com/rutorrent/" "Mozilla/5.0 (Linux; Android 5.1.1; A0001 Build/LMY48W) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.76 Mobile Safari/537.36"
miracle091 commented 9 years ago

This is a apache config error. Do a check to enabled website, under /etc/apache2/sites-enabled/ and look for rutorrent.conf and/or 000-default.conf file. A reboot of apache service is needed after changing the configurations.

For more info look here http://askubuntu.com/a/458645 and here http://stackoverflow.com/a/19357641

dausruddin commented 9 years ago

I already did anything that I know. I check owner of /var/www/rutorrent, it is www-data.

Then I edit rutorrent.conf to enable php.

Yep, I even restarted apache several times already. Still got 403 forbidden error in rutorrent log. I wonder why it cant read rutorrent/php/getsettings.php, it is already chowned to www-data.

miracle091 commented 9 years ago

Do a ls -hall at the rutorrent folder. This can help.

dausruddin commented 9 years ago

I used ls -lah before, to see the user and permission. I guess it just the same as ls -hall right?

Btw, I suspect the permission is the problem. Currently files and folder are chmodded to -rwxrwxr-x (775)

dausruddin commented 9 years ago

I chmodded 755 to folder and 644 to files, but still got Forbidden error

dausruddin commented 9 years ago

Im out of idea. If anyone know what permission I need to set, tell me and let me try.

miracle091 commented 9 years ago

Try to change permission of rutorrent folder to root or another user with root privileges.

dausruddin commented 9 years ago

Problem solved!!!! I was thinking it is all about chmod and chown, I wasnt thinking about permission in apache config. Below is my rutorrent.conf which solved my problem.

<VirtualHost *:80>
        ServerName sub.example.com
        ServerAlias www.sub.example.com
        DocumentRoot /var/www/rutorrent
        CustomLog /var/log/apache2/rutorrent.log vhost_combined
        ErrorLog /var/log/apache2/rutorrent_error.log
        SCGIMount /rutorrent/RPC2 127.0.0.1:5000

        <Directory "/var/www/rutorrent">
                AuthName "Tits or GTFO"
                AuthType Basic
                Require valid-user
                AuthUserFile /var/www/rutorrent/.htpasswd
                Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
                allow from all                                                                                                                         
                AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
                Require all granted
                AddType application/x-httpd-php .php

        </Directory>
</VirtualHost>