PDA

View Full Version : Problem with 403 error and 404 error


X-admin
12th July 2009, 12:59
After uploading web data, my joomla web run normally. But when i upload a .php file (shell.php) from Web-FTP in ISP Panel, and browse in Firefox: http://mysite/shell.php it show 404 error: The requested URL was not found on this server.
Agian, I upload a new .jpeg file like that, browses and get 403 error: You are not permitted to access the requested URL
Login server, i see those file have been chowned. Unluckily, when browses they are unvailable
Who know the problem i encounter?? Is this ISPConfig bug????

till
13th July 2009, 01:11
This is no ISPConfig bug.

1) Which ISPConfig version?
2) Where exactly did you upload the files?

X-admin
13th July 2009, 05:27
This is no ISPConfig bug.

1) Which ISPConfig version?
2) Where exactly did you upload the files?
Thanks till for Reply
My ISPConfig version is 2.2.32
I upload these files to /web directory from ftp-web.
Have you got any idea?

till
13th July 2009, 09:28
Which permissions do the files hae. Please post a "ls -la" output for the php and the jpeg file.

X-admin
13th July 2009, 09:47
Which permissions do the files hae. Please post a "ls -la" output for the php and the jpeg file.
-rwxrwx--- 1 web1_ftp web1 9090 Jul 12 16:47 slax1.jpeg
and
-rwxrwxr-x 1 web2_ftp web2 105540 Jul 12 16:15 shell.php

So, i have no ideas

_X_
13th July 2009, 16:25
well
slax1.jpeg has no public read rights.
-rwxrwx--- should be -rwxrwxr-- but buch better -rw-r--r--
as far as i can see

shell.php:
-rwxrwxr-x should be 644 or -rw-r--r--
no php script should be set like this as far as i know. at least when it comes to joomla.

when it comes to joomla:
all files should be 644 or -rw-r--r--
all folders should be 755 or (d)rwxr-xr-x

also almost all folders and files should be owned by www-data:www-data (user:group) so only apache can access those files. only some folders in images folder should be own by web1_ftp:web1 so images can be uploaded by ftp user.

to correct ownership of files type in console (SSH):
cd /var/www/web1
chown -R -v -f www-data:www-data/*

to set ownership of files and folders in images folder:
cd /var/www/web1/images
chown -R -v -f web1_ftp-web1:web1_ftp-web1/*

this should be done from root account in SSH. in case of Ubuntu you should add "sudo" in front of every command line. for example:
sudo cd /var/www/web1/images
sudo chown -R -v -f web1_ftp-web1:web1_ftp-web1/*

to change all folders to 755 (also as root user):
cd /var/www/web1
find * -type d | while read var1; do chmod 755 "$var1"; done

to change all files to 644 (also as root user):
cd /var/www/web1
find * -type f | while read var1; do chmod 644 "$var1"; done

if i typed it correctly :)

_X_
13th July 2009, 16:29
-rwxrwx--- 1 web1_ftp web1 9090 Jul 12 16:47 slax1.jpeg
and
-rwxrwxr-x 1 web2_ftp web2 105540 Jul 12 16:15 shell.php

So, i have no ideas

also shell.php is owned by web2 user and slax.jpeg by web1 user. those are users from two different "sites"?

X-admin
13th July 2009, 17:44
also shell.php is owned by web2 user and slax.jpeg by web1 user. those are users from two different "sites"?

Oh, wonderful. I understand. These rules i have never care so.....:confused:
Thanks X very much

X-admin
13th July 2009, 18:04
also almost all folders and files should be owned by www-data:www-data (user:group) so only apache can access those files. only some folders in images folder should be own by web1_ftp:web1 so images can be uploaded by ftp user.

to correct ownership of files type in console (SSH):
cd /var/www/web1
chown -R -v -f www-data:www-data/*

to set ownership of files and folders in images folder:
cd /var/www/web1/images
chown -R -v -f web1_ftp-web1:web1_ftp-web1/*


Dear _X_!
i don't know about this quote. who www-data:www-data any else? I think there is only a user:group is web1_ftp:web1 for each directory and file in /web
apache user is in group web1?

_X_
13th July 2009, 21:48
No www-data:www-data is user:group that Apache/SuExec uses to access file system - if I explained it correctly.

Bottom line is:
If you want to install modules/components/extensions in Joomla you should have all your folders and files chown-ed to www-data:www-data.
Except images folder where you will upload pictures - this folder can be web1_ftp-web1:web1_ftp-web1

If installation from zip files doesn’t work you can unpack desired extension in some folder and go with install from directory procedure.
This depends what Joomla are you using and what Linux distribution have you installed.

_X_
13th July 2009, 21:51
here is few additional tips for ISPConfig and Joomla:

http://howtoforge.com/forums/showpost.php?p=155251&postcount=19

_X_
13th July 2009, 21:55
although I have made additional changes to my Joomla directives so it looks something like this:

<Directory "/var/www/webXXX/web">
Options FollowSymLinks
php_admin_flag register_globals Off
php_admin_value disable_functions "show_source system shell_exec passthru exec phpinfo popen proc_open"
php_admin_flag allow_url_fopen Off
php_admin_flag magic_quotes_gpc On
php_admin_value session.save_path "/var/www/webXXX/phptmp"
php_admin_value open_basedir "/var/www/webXXX/"
php_admin_value memory_limit 24M
</Directory>

change webXXX to your values. also if needed more memory by Joomla increase 24M to 30M.

X-admin
15th July 2009, 06:55
although I have made additional changes to my Joomla directives so it looks something like this:

<Directory "/var/www/webXXX/web">
Options FollowSymLinks
php_admin_flag register_globals Off
php_admin_value disable_functions "show_source system shell_exec passthru exec phpinfo popen proc_open"
php_admin_flag allow_url_fopen Off
php_admin_flag magic_quotes_gpc On
php_admin_value session.save_path "/var/www/webXXX/phptmp"
php_admin_value open_basedir "/var/www/webXXX/"
php_admin_value memory_limit 24M
</Directory>

change webXXX to your values. also if needed more memory by Joomla increase 24M to 30M.

Specially thanks _X_. I understand much more