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 31st July 2012, 14:59
centurianii centurianii is offline
Junior Member
 
Join Date: Mar 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Smile Apache2 With mod_fcgid And PHP5 On Ubuntu 11.10

Hello there,

I'm trying to setup suexec in a cloud environment following this article: http://www.howtoforge.com/how-to-set...n-ubuntu-11.10
My question is simple: I don't want to use virtual domains as the author suggests but rather virtual subdomains in the form: john.superbhosting.com, alice.superbhosting.com etc.
Moreover, i don't want to reload again and again the apache2 server.
I've read the apache documentation for virtual domains and subdomains but how should apply all this to my Ubuntu 11.10 server?

Thank you in advance!
Reply With Quote
Sponsored Links
  #2  
Old 1st August 2012, 15:05
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,749 Times in 2,579 Posts
Default

I think this is what you're looking for: http://httpd.apache.org/docs/2.2/en/vhosts/mass.html
__________________
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
The Following User Says Thank You to falko For This Useful Post:
centurianii (1st August 2012)
  #3  
Old 1st August 2012, 23:51
centurianii centurianii is offline
Junior Member
 
Join Date: Mar 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default Apache mass virtual hosting and suExec

Thank you Falco for your fast answer!

I'm aware of this link from Apache documentation but I have some questions there: Apache suggests the use of httpd.conf file whereas you suggest to write files at /var/www/ directory. Which approach is better?

Apache suggest to use mod_vhost_alias or mod_rewrite. Is some method better than the other? I think the first one is simpler.

There is another think I'm wondering about after reading this article some time ago: http://jp-larocque.livejournal.com/49475.html

The writer implies that some php can run under suExec with user writes and some other "non-userdir FastCGI scripts" to NOT use suEXEC. For that reason he gives a hack, a FastCGI wrapper hack script at /usr/local/sbin/fastcgi-suexec-hack:
Code:
#!/bin/sh
# This hack exists exclusively to work around the restriction that
# FastCGI wrappers (e.g. suEXEC) are an all-or-nothing ordeal.  Thou
# shalt not enable wrappers for userdirs but not for the whole site.
# Thou shalt not configure non-userdir FastCGI scripts to use suEXEC
# or thou shall suffer my wrath of mysterious suexec policy violation
# notices for 7 generations.
a php library 
username="$1"
group="$2"
application="$3"

case "$(pwd)/" in
/home/*/public_html/*)
	exec /usr/lib/apache2/suexec "$username" "$group" "$application";;
*)
	application_abs="$(readlink -f "$application")"
	exec "$application_abs";;
esac
(my first language is not English and I need Oxford dictionary to understand "thou shall"!!)

My question is this: can I mix user php code with user permissions with a php library that has boarder permissions and runs as a www-data or even a user from the sudoers group??
(some require_once headers should import the php library but what is required is the user NOT to be able to hack that library)

Thanks again!
Reply With Quote
  #4  
Old 2nd August 2012, 14:37
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,749 Times in 2,579 Posts
Default

Quote:
Originally Posted by centurianii View Post
Thank you Falco for your fast answer!

I'm aware of this link from Apache documentation but I have some questions there: Apache suggests the use of httpd.conf file whereas you suggest to write files at /var/www/ directory. Which approach is better?
You're mixing things up - /var/www/ is the document root where you must upload your HTML, PHP files, images, etc. while httpd.conf (or apache2.conf) are configuration files for Apache.
__________________
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
  #5  
Old 2nd August 2012, 21:18
centurianii centurianii is offline
Junior Member
 
Join Date: Mar 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default

1)
Quote:
Originally Posted by falko View Post
You're mixing things up - /var/www/ is the document root where you must upload your HTML, PHP files, images, etc. while httpd.conf (or apache2.conf) are configuration files for Apache.
Yes, indeed!!
Correcting myself: you suggested to create files at /etc/apache2/sites-available/ in the form:
Code:
<VirtualHost *:80>
...
</VirtualHost>
whereas Apache suggests writing at httpd.conf....(?)
2)
At the wrapper script at /var/www/php-fcgi-scripts/web1/php-fcgi-starter, you wrote:
Code:
...
exec /usr/lib/cgi-bin/php
but look at my installation:
Code:
xxx@xxx:~$ ls -al /usr/lib/cgi-bin
total 7952
drwxr-xr-x  2 root root    4096 2012-06-11 22:24 .
drwxr-xr-x 56 root root   12288 2012-07-15 13:56 ..
lrwxrwxrwx  1 root root      29 2012-06-11 22:24 php -> /etc/alternatives/php-cgi-bin
-rwxr-xr-x  1 root root 8112496 2012-05-04 02:01 php5
and
Code:
xxx@xxx:~$ ls -al /usr/bin
...
-rwxr-xr-x  1 root   root    8112496 2012-05-04 02:01 php5-cgi
lrwxrwxrwx  1 root   root         25 2012-06-11 22:24 php-cgi -> /etc/alternatives/php-cgi
...
...why calling /etc/alternatives/php-cgi-bin and not:
Code:
exec /usr/lib/cgi-bin/php5
or,
Code:
exec /usr/bin/php5-cgi
instead??
Reply With Quote
  #6  
Old 8th August 2012, 19:39
centurianii centurianii is offline
Junior Member
 
Join Date: Mar 2009
Posts: 13
Thanks: 1
Thanked 0 Times in 0 Posts
Default (104)Connection reset by peer: mod_fcgid: error

Hi,

following Falco's tutorial I set up a new domain, I'll call it www.john.com and I tried to see the result when I hit my browser to www.john.com/info.php:
Code:
Title: 500 Internel Server Error
Message: Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@john.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
At my /var/log/apache2/error.log:
Code:
[Wed Aug 08 17:25:19 2012] [warn] [client xxx.xxx.xxx.xxx] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://www.john.com/
[Wed Aug 08 17:25:19 2012] [error] [client xxx.xxx.xxx.xxx] Premature end of script headers: info.php, referer: http://www.john.com/
From what I can see googling this error there is no simple solution or solution at all
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


All times are GMT +2. The time now is 17:15.


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