Re: set up mass virtual hosting with apache/nginx and PHP ... best practice 2012?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 26, 2012 at 2:30 AM, D. Dante Lorenso <dante@xxxxxxxxxxx> wrote:

>
> Using VirtualDocumentRoot, I was able to create a virtual host defined
> like this:
>

<VirtualHost *:80>
> ServerName student.sampledomain.edu
> ServerAlias *.student.sampledomain.edu
>
> DocumentRoot /mnt/web/student.sampledomain.**edu/docroot<http://student.sampledomain.edu/docroot>
> UseCanonicalName Off
> VirtualDocumentRoot /mnt/userwww/%-4+
>
> ErrorLog "|/usr/bin/logger -p local6.notice -t 'error-student'"
> CustomLog "|/usr/bin/logger -p local6.notice -t 'access-student'" full
> </VirtualHost>
>
> That maps domain names like <username>.student.**sampledomain.edu<http://student.sampledomain.edu>to directories in the /mnt/userwww/<username> directory.  That gets me
> close, but isn't handling PHP yet.  I think Apache also runs as 'apache'
> user when reading all the files, so users must chmod their files world
> readable still for this to work.
>
> I don't know what you means "isn't handling PHP yet". If you want Apache
handling a PHP program, you must integrate PHP and Apache, in FreeBSD and
Apache, these lines must be written in httpd.conf:

# Apache 2.x
LoadModule php5_module        libexec/apache/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

The above lines will tell apache to execute php file as a PHP program.
For your latest statement, Yes, default Apache will handling program as
'apache' user. But, if you use suPHP, suExec, or other similiar program,
the file will be execute as a user that own the files. So, in other words,
you must use 'chown' program to assure the php files is own by the right
user. The files still readable with that program if you use secure and
right mode with 'chmod' program. For security reason, you must always use
755 for directory and mode 644 for files.


> You reference "suPHP" as the way to go.  The problem I have with that is
> this website:
> http://www.suphp.org/Home.html
>
> Looks like the last update was back in 2009.  That's more than 3 years
> ago.  I think that project has stalled.  There must be something newer that
> has replaced it since then.
>
> I think the suPHP project is not dead yet. It's because the program is
small and just doing a simple task and if the suPHP program still work for
the latest Apache today, why do we must question it? Even small notepad
from 10 years ago can still be used today, right? If you want advanced and
simple task to manage files for each user, you must buy commercial program
like cPanel or Plesk.


-- 
Duken Marga

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux