Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 13th May 2012, 05:57
vestport4 vestport4 is offline
Junior Member
 
Join Date: Jun 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Listing Directories and CGI

Hello, Running ISPCONFIG3 on 64 bit centos 5.8 Final

Having problems configuring my system to list directories in

Code:
"/var/www/mydomain.com/web/files/"
and running cgi in
Code:
/var/www/mydomain.com/web/files/cgi/
I check /etc/httpd/conf/sites-enabled/mysite.com.vhost and noticed several of similar listings for the directory like:

Code:
     <Directory /var/www/mydomain.com/web>
        AddHandler fcgid-script .php .php3 .php4 .php5
        FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter .php
        Options +ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
        <Directory /var/www/clients/client1/web1/web>
        AddHandler fcgid-script .php .php3 .php4 .php5
        FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter .php
        Options +ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>



<Directory /var/www/mydomain.com/web>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all

        # ssi enabled
        AddType text/html .shtml
        AddOutputFilter INCLUDES .shtml
        Options +Includes
 </Directory>
 <Directory /var/www/clients/client1/web1/web>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all

        # ssi enabled
        AddType text/html .shtml
        AddOutputFilter INCLUDES .shtml
        Options +Includes
 </Directory>


 <Directory /var/www/mydomain.com/web>
        AddHandler fcgid-script .php .php3 .php4 .php5
        FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter .php
        Options +ExecCGI
        AllowOverride All
        Order allow,deny

A few questions:

First: Does one entry with the same path just keep over writing the other?

Second: Can I back this file up and regenerate a default file without blowing away the domain & web files etc.

Third: Is it safe to edit directly (with a backup of course)?

Fourth: Will anything overwrite this file automatically in the future (updates)?


Tried apache directives from the ISPCONFIG console and no luck. Also, tried apache directives for a different domain to try to +Indexes etc. and no luck. In fact on the other domain after /etc/init.d/httpd restart I don't even see the updates in the .vhost file.

Also, just wanted to mention that NO I don't have any .htaccess file in these directories.

I do however have Joomla installed. Not sure if that is a deal breaker or need to chmod special permissions.




Here is the entire .vhost file for the domain in question below:

<Directory /var/www/myhost.com>
AllowOverride None
Order Deny,Allow
Deny from all
</Directory>

<VirtualHost *:80>
DocumentRoot /var/www/myhost.com/web

ServerName myhost.com
ServerAlias www.myhost.com
ServerAlias renrealtors.myhost.com
ServerAlias mail.myhost.com
ServerAlias mls.myhost.com
ServerAlias admin.myhost.com
ServerAlias office.myhost.com
ServerAlias preforeclosures.myhost.com
ServerAlias joomla.myhost.com
ServerAlias shortsales.myhost.com
ServerAdmin webmaster@myhost.com

ErrorLog /var/log/ispconfig/httpd/myhost.com/error.log

ErrorDocument 400 /error/400.html
ErrorDocument 401 /error/401.html
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 405 /error/405.html
ErrorDocument 500 /error/500.html
ErrorDocument 503 /error/503.html

<Directory /var/www/myhost.com/web>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

# ssi enabled
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Options +Includes
</Directory>
<Directory /var/www/clients/client1/web1/web>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

# ssi enabled
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Options +Includes
</Directory>

<IfModule mod_ruby.c>
<Directory /var/www/clients/client1/web1/web>
Options +ExecCGI
</Directory>
RubyRequire apache/ruby-run
#RubySafeLevel 0
<Files *.rb>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>
<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>
</IfModule>

# cgi enabled
<Directory /var/www/clients/client1/web1/cgi-bin>
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /var/www/clients/client1/web1/cgi-bin/
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
# suexec enabled
SuexecUserGroup web1 client1
# Clear PHP settings of this website
<FilesMatch "\.ph(p3?|tml)$">
SetHandler None
</FilesMatch>
# php as fast-cgi enabled
<IfModule mod_fcgid.c>

# SocketPath /tmp/fcgid_sock/

# IdleTimeout n (3600 seconds)
# An idle fastcgi application will be terminated after IdleTimeout sec
onds.
IdleTimeout 3600

# ProcessLifeTime n (7200 seconds)
# A fastcgi application will be terminated if lifetime expired, even no error is detected.
ProcessLifeTime 7200

# MaxProcessCount n (1000)
# The max count of total fastcgi process count.
# MaxProcessCount 1000

# DefaultMinClassProcessCount n (3)
# The minimum number of fastcgi application instances for any one fastcgi application.
# Idle fastcgi will not be killed if their count is less than n
# Set this to 0, and tweak IdleTimeout
DefaultMinClassProcessCount 0

# DefaultMaxClassProcessCount n (100)
# The maximum number of fastcgi application instances allowed to run for
# particular one fastcgi application.
DefaultMaxClassProcessCount 100
# IPCConnectTimeout n (3 seconds)
# The connect timeout to a fastcgi application.
IPCConnectTimeout 8

# IPCCommTimeout n (20 seconds)
# The communication timeout to a fastcgi application. Please increase this
# value if your CGI have a slow initialization or slow respond.
IPCCommTimeout 360

# BusyTimeout n (300 seconds)
# A fastcgi application will be terminated if handing a single request
# longer than busy timeout.
BusyTimeout 300

</IfModule>
<Directory /var/www/myhost.com/web>
AddHandler fcgid-script .php .php3 .php4 .php5
FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter .php
Options +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/clients/client1/web1/web>
AddHandler fcgid-script .php .php3 .php4 .php5
FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter .php
Options +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

RewriteEngine on
RewriteCond %{HTTP_HOST} ^renrealtors.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com/files/renrealtors/$1 [L]
RewriteCond %{HTTP_HOST} ^mail.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com:8080/webmail/$1 [R,L]
RewriteCond %{HTTP_HOST} ^mls.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com/files/mls/$1 [L]
RewriteCond %{HTTP_HOST} ^admin.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com:8080/$1 [L]
RewriteCond %{HTTP_HOST} ^office.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com/files/office/$1 [L]
RewriteCond %{HTTP_HOST} ^preforeclosures.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com/files/preforeclosures/$1 [L]
RewriteCond %{HTTP_HOST} ^joomla.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com/administrator/$1 [L]
RewriteCond %{HTTP_HOST} ^shortsales.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.vesport.com/files/preforeclosures/$1 [L]

# add support for apache mpm_itk
<IfModule mpm_itk_module>
AssignUserId web1 client1
</IfModule>

<IfModule mod_dav_fs.c>
# DO NOT REMOVE THE COMMENTS!
# IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
# WEBDAV BEGIN
# WEBDAV END
</IfModule>


</VirtualHost>



<IfModule mod_ssl.c>
################################################## #########
# SSL Vhost
################################################## #########

<VirtualHost *:443>
DocumentRoot /var/www/myhost.com/web

ServerName myhost.com
ServerAlias www.myhost.com
ServerAlias renrealtors.myhost.com
ServerAlias mail.myhost.com
ServerAlias mls.myhost.com
ServerAlias admin.myhost.com
ServerAlias office.myhost.com
ServerAlias preforeclosures.myhost.com
ServerAlias joomla.myhost.com
ServerAlias shortsales.myhost.com
ServerAdmin webmaster@myhost.com

ErrorLog /var/log/ispconfig/httpd/myhost.com/error.log

ErrorDocument 400 /error/400.html
ErrorDocument 401 /error/401.html
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 405 /error/405.html
ErrorDocument 500 /error/500.html
ErrorDocument 503 /error/503.html

SSLEngine on
SSLCertificateFile /var/www/clients/client1/web1/ssl/myhost.com.crt
SSLCertificateKeyFile /var/www/clients/client1/web1/ssl/myhost.com.key

<Directory /var/www/myhost.com/web>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

# ssi enabled
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Options +Includes
</Directory>
<Directory /var/www/clients/client1/web1/web>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

# ssi enabled
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
Options +Includes
</Directory>

# cgi enabled
<Directory /var/www/clients/client1/web1/cgi-bin>
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ /var/www/clients/client1/web1/cgi-bin/
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
# ssi enabled
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
# suexec enabled
SuexecUserGroup web1 client1
# Clear PHP settings of this website
<FilesMatch "\.ph(p3?|tml)$">
SetHandler None
</FilesMatch>
# php as fast-cgi enabled
<IfModule mod_fcgid.c>
# SocketPath /tmp/fcgid_sock/
# IdleTimeout n (3600 seconds)
# An idle fastcgi application will be terminated after IdleTimeout seconds.
IdleTimeout 3600

# ProcessLifeTime n (7200 seconds)
# A fastcgi application will be terminated if lifetime expired, even no error is detected.
ProcessLifeTime 7200

# MaxProcessCount n (1000)
# The max count of total fastcgi process count.
# MaxProcessCount 1000

# DefaultMinClassProcessCount n (3)
# The minimum number of fastcgi application instances for any one fastcgi
application.
# Idle fastcgi will not be killed if their count is less than n
# Set this to 0, and tweak IdleTimeout
DefaultMinClassProcessCount 0

# DefaultMaxClassProcessCount n (100)
# The maximum number of fastcgi application instances allowed to run for
# particular one fastcgi application.
DefaultMaxClassProcessCount 100

# IPCConnectTimeout n (3 seconds)
# The connect timeout to a fastcgi application.
IPCConnectTimeout 8

# IPCCommTimeout n (20 seconds)
# The communication timeout to a fastcgi application. Please increase this
# value if your CGI have a slow initialization or slow respond.
IPCCommTimeout 360

# BusyTimeout n (300 seconds)
# A fastcgi application will be terminated if handing a single request
# longer than busy timeout.
BusyTimeout 300
</IfModule>
<Directory /var/www/myhost.com/web>
AddHandler fcgid-script .php .php3 .php4 .php5
FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter .php
Options +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/clients/client1/web1/web>
AddHandler fcgid-script .php .php3 .php4 .php5
FCGIWrapper /var/www/php-fcgi-scripts/web1/.php-fcgi-starter .php
Options +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

RewriteEngine on
RewriteCond %{HTTP_HOST} ^renrealtors.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com/files/renrealtors/$1 [L]
RewriteCond %{HTTP_HOST} ^mail.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com:8080/webmail/$1 [R,L]
RewriteCond %{HTTP_HOST} ^mls.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com/files/mls/$1 [L]
RewriteCond %{HTTP_HOST} ^admin.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com:8080/$1 [L]
RewriteCond %{HTTP_HOST} ^office.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com/files/office/$1 [L]
RewriteCond %{HTTP_HOST} ^preforeclosures.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com/files/preforeclosures/$1 [L]
RewriteCond %{HTTP_HOST} ^joomla.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com/administrator/$1 [L]
RewriteCond %{HTTP_HOST} ^shortsales.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.vesport.com/files/preforeclosures/$1 [L]

# add support for apache mpm_itk
<IfModule mpm_itk_module>
AssignUserId web1 client1
</IfModule>

<IfModule mod_dav_fs.c>
# DO NOT REMOVE THE COMMENTS!
# IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
# WEBDAV BEGIN
RewriteCond %{HTTP_HOST} ^preforeclosures.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com/files/preforeclosures/$1 [L]
RewriteCond %{HTTP_HOST} ^joomla.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.myhost.com/administrator/$1 [L]
RewriteCond %{HTTP_HOST} ^shortsales.myhost.com [NC]
RewriteRule ^/(.*)$ https://www.vesport.com/files/preforeclosures/$1 [L]

# add support for apache mpm_itk
<IfModule mpm_itk_module>
AssignUserId web1 client1
</IfModule>

<IfModule mod_dav_fs.c>
# DO NOT REMOVE THE COMMENTS!
# IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
# WEBDAV BEGIN
# WEBDAV END
</IfModule>


</VirtualHost>
</IfModule>






Thanks in advance for any replies.


Art

Last edited by vestport4; 13th May 2012 at 06:08. Reason: Additional Information
Reply With Quote
Sponsored Links
  #2  
Old 14th May 2012, 12:56
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,740 Times in 2,575 Posts
Default

Quote:
Originally Posted by vestport4 View Post

and running cgi in
Code:
/var/www/mydomain.com/web/files/cgi/
You must place CGI files in the cgi-bin directory.

Quote:
Originally Posted by vestport4 View Post
First: Does one entry with the same path just keep over writing the other?
Same directives will overwrite each other, the rest justs adds up.

Quote:
Originally Posted by vestport4 View Post
Second: Can I back this file up and regenerate a default file without blowing away the domain & web files etc.

Third: Is it safe to edit directly (with a backup of course)?

Fourth: Will anything overwrite this file automatically in the future (updates)?
ISPConfig will overwrite your changes if you edot the file directly, therefore you should use the Apache Directives field. You can also define a custom vhost template by copying /usr/local/ispconfig/server/conf/vhost.conf.master to the /usr/local/ispconfig/server/conf-custom/ directory. You can then modify /usr/local/ispconfig/server/conf-custom/vhost.conf.master to your needs, and ISPConfig will use that one instead of /usr/local/ispconfig/server/conf/vhost.conf.master.
__________________
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
  #3  
Old 14th May 2012, 13:37
vestport4 vestport4 is offline
Junior Member
 
Join Date: Jun 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Falko,

When you say place cgi files in the cgi-bin directory. Does it make a difference that it is actually named cgi-bin? I mean I know that is traditional or whatever but as long as there is +ExecCGI and AddHandler cgi-script .cgi
AddHandler cgi-script .pl it cgi files should be able to go anywhere no?

Or are you saying that .cgi files cannot be run on the virtual host and need to be in the main /cgi-bin/directory of the host that handles all the virtual domains?

Part of the problem is that I can't even do a directory listing like I use to be able to do in non-cgi directories on ISPCONFIG2. Like when I would:

Code:
http://www.mydomain.com/files/
I would see:

Code:
file1
file2
file3
Now all I get is an error.

The only way I can see a file is if I actually know what it is like:

Code:
http://www.mydomain.com/files/file1
I cannot do a directory listing even with Options +Indexex. I figured that this is one and the same problem why I can't use my cgi files.

Do apache directives take precedence over the .vhost files or rather is there anything in the .vhost files that would overwrite apache directives preventing me from running cgi and listing directories?

Below are my apache directives that I have been trying with no luck:

Code:
<Directory /var/www/clients/client1/web1/files/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

<Directory /var/www/clients/client1/web1/files/cgi/
AddHandler cgi-script .cgi .pl
Options FollowSymLinks +ExecCGI 
</Directory>
I used this with and without a + on Indexes and no luck

After changes I would:

Code:
/etc/init.d/httpd restart
and wait a few secs for changes to take effect.

Am I doing something wrong?


Thanks for advice about where to keep files and overwrites. Now I know how to handle that once I get directory listings and cgi working right.


Thanks,


Art
Reply With Quote
  #4  
Old 15th May 2012, 15:11
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,740 Times in 2,575 Posts
 
Default

Quote:
When you say place cgi files in the cgi-bin directory. Does it make a difference that it is actually named cgi-bin? I mean I know that is traditional or whatever but as long as there is +ExecCGI and AddHandler cgi-script .cgi
AddHandler cgi-script .pl it cgi files should be able to go anywhere no?

Or are you saying that .cgi files cannot be run on the virtual host and need to be in the main /cgi-bin/directory of the host that handles all the virtual domains?
By default cgi files work only in the main /cgi-bin directory. But of course you can define your own location for CGI scripts with the Apache Directives.
__________________
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
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
Trying to get a cgi script to work drahcir77 HOWTO-Related Questions 14 10th January 2011 18:14
problem with upgrade to 2.2.34 brianetilley Installation/Configuration 14 11th November 2009 17:22
FTP cannot open remote folder!?! andysm849 Server Operation 23 16th October 2008 23:34
Can't start apache Musty Server Operation 12 9th March 2008 13:58
Logic behind ISPConfig site directories webbinALLnite General 1 15th October 2007 11:28


All times are GMT +2. The time now is 01:47.


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