Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 15th February 2007, 11:16
Ovidiu Ovidiu is offline
Senior Member
 
Join Date: Sep 2005
Posts: 1,257
Thanks: 75
Thanked 22 Times in 18 Posts
Question howto add these apache directives?

I need one folder i.e. /var/www/web1/web/folder/ to have these directives applied to:

Quote:
# Disable listing of user files
DirectoryIndex index.php
# Options -Indexes

# Disable php in userfiles directory (recommended!!!!)
# RemoveType php
# <IfModule mod_php4.c>
# php_flag engine 0
# </IfModule>

<IfModule mod_php5.c>
php_flag engine 0
</IfModule>

# GET requests only
<LimitExcept GET>
Order Allow,Deny
</LimitExcept>

# This file MUST be in the user files directory in order for bandwidth tracking to work.
# Bandwidth tracking requires your server to have the mod_rewrite module enabled. If you do not have it,
# you will probably get some Internal Server Error messages.
# To disable bandwidth tracking, comment out the lines below that start with Rewrite...or delete everything from here (this line).
# The file.php path MUST be correct in order for bandwidth tracking to work correctly.
# You can use either relative or absolute path. If none works try entering the FULL url
# to file.php as in this example below:
# EXAMPLE ONLY: RewriteRule ^([0-9]+)/(.+)$ http://celerondude.com/uploaderv6/file.php?userid=$1&file=$2 [L,NC]

# Turn on mod_rewrite
RewriteEngine On

# This block will disable image hotlinking. The images will only be viewable
# through a page on your site. This will enable you to put ads or whatever you want
# around the image. If you disable this, the images can be viewed directly.
# To disable, comment out the two lines below.
# Enter your domain name in the line that starts with RewriteCond. Here are some examples:
# Example 1: RewriteCond %{HTTP_REFERER} !^http://(www\.)?celerondude\.com/? [NC]
# Example 2: RewriteCond %{HTTP_REFERER} !^http://(www\.)?google\.com/? [NC]
# If you get a 404 error, enter the absolute path to view.php instead of just ../view.php.
# RewriteCond %{HTTP_REFERER} !^http://localhost/? [NC]
# RewriteRule ^([0-9]+)/(.+)$ ../view.php?userid=$1&file=$2 [L,NC]

# Use the uploader to view the image instead of viewing it directly.
# If you get a 404 error, enter the absolute path to view.php instead of just ../view.php.
RewriteRule ^view/([0-9]+)/(.+\.(jpe?g|gif|bmp|png))$ ../view.php?userid=$1&file=$2 [L,NC]

# Very important, do not remove. Required for bandwidth tracking.
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^([0-9]+)/(.+)$ ../file.php?userid=$1&file=$2 [L,NC]
btw. the subdomain folder.domain.com serves its files from this folder by an entryinside .htaccess using a rewrite.

can you give me some hints? maybe some parts of the directives are unnecesary? I am using a perfect debian 3.1 install with latest ispconfig.
Reply With Quote
Sponsored Links
  #2  
Old 15th February 2007, 14:59
omni omni is offline
Member
 
Join Date: Jan 2007
Posts: 62
Thanks: 4
Thanked 1 Time in 1 Post
Default

I ran into something like this yesterday, hopefully this fix works for you as well...

In IPSConfig, In the root of your intended site, at the bottom look for the ' Apache Directives (Optional)' box. Input the following.

Code:
<Directory '/var/www/web2/web/gallery'>
   AllowOverride Options FileInfo
</Directory>
Except change the directory path to the one you need. Then, make a .htaccess file with what you need (as you posted above).
Reply With Quote
  #3  
Old 15th February 2007, 21:16
Ovidiu Ovidiu is offline
Senior Member
 
Join Date: Sep 2005
Posts: 1,257
Thanks: 75
Thanked 22 Times in 18 Posts
Default

I was not sure if I could input all that stuff above into the directives fields...

SO if I got you right, by inputting what you said in the directives field, I could then use this .htaccess I pasted above?
Reply With Quote
  #4  
Old 15th February 2007, 21:26
omni omni is offline
Member
 
Join Date: Jan 2007
Posts: 62
Thanks: 4
Thanked 1 Time in 1 Post
Default

from what I understand, yes.

and if it doesn't work... just delete the .htaccess and the apache directives and try something else.
Reply With Quote
  #5  
Old 15th February 2007, 23:10
Ovidiu Ovidiu is offline
Senior Member
 
Join Date: Sep 2005
Posts: 1,257
Thanks: 75
Thanked 22 Times in 18 Posts
Default

I was just concerned about security, as this is a file uploading / sharing application, so I really wanted to use those directives inside a .htaccess file to turn php off for the uplaod folders...

btw. the rewrite stuff works inside the .htaccess its just these:

Quote:
# Disable php in userfiles directory (recommended!!!!)
# RemoveType php
# <IfModule mod_php4.c>
# php_flag engine 0
# </IfModule>

<IfModule mod_php5.c>
php_flag engine 0
</IfModule>

# GET requests only
<LimitExcept GET>
Order Allow,Deny
</LimitExcept>
that give me errors if I put them inside .htaccess files.

I'll try your advice tomorrow, going to bed now.
Reply With Quote
  #6  
Old 16th February 2007, 08:12
Ovidiu Ovidiu is offline
Senior Member
 
Join Date: Sep 2005
Posts: 1,257
Thanks: 75
Thanked 22 Times in 18 Posts
Default

somethign is wrong around here, do I have to cut away the ' ' around the path of the directory? I tried cutting them away, ispc saves my directive without error but when I go to test the site I am talking about, I get an 500 server error without modifying my .htassess file !? very strange, here is how my .htaccess looks like:

Quote:
DirectoryIndex index.php
# Options -Indexes

# These might give you an error if PHP is not installed as a module.
# php_value upload_max_filesize 200M
# php_value post_max_size 200M
# php_value short_open_tag 1
# For public uploader
RewriteRule ^register/?$ account.php?action=register [L,NC]
RewriteRule ^login/?$ account.php?action=login [L,NC]
RewriteRule ^pupload/?$ public.php [L,NC]
RewriteRule ^pupload/browse(/([0-9]+))?/?$ public.php?action=browse&page=$2 [L,NC]
RewriteRule ^pupload/view/([0-9]+)/?$ public.php?action=view&upload_id=$1 [L,NC]
RewriteRule ^pupload/manage/([0-9]+)/([0-9a-z]+)/?$ public.php?action=manage&upload_id=$1&key=$2 [L,NC]
RewriteRule ^myfiles(/(.*))?$ myfiles.php?folder=$1 [L,NC]
RewriteRule ^upload(/(.*))?$ upload.php?upload_to=$1 [L,NC]
RewriteRule ^members/?$ browse.php [L,NC]
RewriteRule ^members/([0-9]+)/?$ browse.php?page=$1 [L,NC]
RewriteRule ^members/public/?([0-9]+)?/?$ browse.php?public=1&page=$1 [L,NC]
RewriteRule ^members/info/([0-9]+)$ browse.php?action=info&userid=$1 [L,NC]
RewriteRule ^members/browse/([0-9]+)/?(/.+)?$ browse.php?action=browse&userid=$1&folder=$2 [L,NC]
#RewriteRule ^([a-z0-9\_]+)/?$ browse.php?action=browse&username=$1 [L,NC]
you see I commented out some lines and have it working without the directives. If I add in the directive you gave, using this same .htaccess it stops working...
Reply With Quote
  #7  
Old 16th February 2007, 08:15
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,446
Thanks: 813
Thanked 5,216 Times in 4,089 Posts
Default

Please have a look at the apache error log of the website to get a detailed error message for you 500 error.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #8  
Old 20th February 2007, 08:45
Ovidiu Ovidiu is offline
Senior Member
 
Join Date: Sep 2005
Posts: 1,257
Thanks: 75
Thanked 22 Times in 18 Posts
Default

ok, I enabled this line: Options -Indexes in the .htaccess and get 500 error

Quote:
www.zice.ro||||-||||62.159.242.*** - - [20/Feb/2007:08:09:10 +0100] "GET / HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
but this looks strange: why does it say www.zice.ro if the url I am trying to reach is filehosting.zice.ro?

ok, I just skipped these problems and uploaded an image, which went fine but when trying to view the uploaded image I get an error 500 too, but in the logfile it says error 404 ???

Quote:
www.zice.ro||||-||||62.159.242.*** - - [20/Feb/2007:08:18:03 +0100] "GET /public/pview/1/netstat-day.png HTTP/1.1" 404 - "http://filehosting.zice.ro/pupload/browse" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0"
hmm... I think the problem might not be with these apache directives... I just took out this:
Quote:
<Directory /var/www/web5/filehosting>
AllowOverride Options FileInfo
</Directory>
and still the same errors...

Ok if someone wants to test, here is the link to the site: http://filehosting.zice.ro and I will attach the .htaccess files here for reviewing. Currently I have only this directive inside my apache directive field in ispc:
Quote:
Options FollowSymLinks
<Directory /var/www/web5> AllowOverride All
</Directory>
as this subdomain is part of a bigger thing that needs this directive.

The bigger thing is handling all subdomains via wildcard domain, only filehosting is excluded and it seemed to work fine, but where do you think these 500 errors come from? why would there be a www.zice.ro not filehosting.zice.ro involved in the logfiles?

###edit###
the main htaccess file is inside the root of this subdomain, the public one is inside the folder with public uploaded files and the userfiles one is inside the folder containing users files

###edit-again###
commented these:
Quote:
<IfModule mod_php4.c>
php_flag engine 0
</IfModule>
out - now the public upload works, you see the thumbnails but the links to the original sized pictures doesn't work.
Attached Files
File Type: txt htaccess.main.txt (1.4 KB, 248 views)
File Type: txt htaccess.public.txt (1.6 KB, 223 views)
File Type: txt htaccess.userfiles.txt (2.2 KB, 247 views)

Last edited by Ovidiu; 20th February 2007 at 14:15.
Reply With Quote
  #9  
Old 21st February 2007, 22:42
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,722 Times in 2,563 Posts
Default

Is filehosting.zice.ro a Co-Domain of the www.zice.ro web site, or is it a web site of its own?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #10  
Old 22nd February 2007, 07:44
Ovidiu Ovidiu is offline
Senior Member
 
Join Date: Sep 2005
Posts: 1,257
Thanks: 75
Thanked 22 Times in 18 Posts
 
Default

it is a subdomain which gets redirected via .htaccess to its own folder

Quote:
RewriteCond %{HTTP_HOST} filehosting.zice.ro
RewriteCond %{REQUEST_URI} !filehosting/
RewriteRule ^(.*)$ filehosting/$1 [L]
but there is now www host, I dont use it and this domain doesn't even work with it, I never configured it anywhere...
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Add user 'apache' into new group asyadiqin Installation/Configuration 4 16th November 2007 16:59
Centos 4.4 32bit Hangs, High Server load 3cwired_com Server Operation 11 16th November 2006 15:47
HowTo Add Mailfiltering to the Falko howto Postfix Guide rockwilda HOWTO-Related Questions 15 20th October 2006 15:40
Apache Directives vs PHP Safe Mode heri Installation/Configuration 1 11th May 2006 18:07
Problem with the installation of Dokeos (LMS) in ISPConfig jofranco General 4 28th April 2006 00:45


All times are GMT +2. The time now is 03:04.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.