We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
Apache processes not running as user?
Apache processes not running as user?
I'm not sure, but the process for the user apache not runs as a user?, this is so or am I doing something wrong?
If I'm not wrong, how manage customer processes?
regards
If I'm not wrong, how manage customer processes?
regards
Re: Apache processes not running as user?
ok, the problem is phpfcgid template (is not working).
create a index.php into public_html:
$ vim index.php
<?php
phpinfo();
?>
then if I go to web site, only see the text:
<?php
phpinfo();
?>
and not the result :(
if it worked then you should run the process /usr/bin/php-cgi as a user,for example ($ ps -ef f):
apache \_ /usr/sbin/httpd
user | \_ /usr/bin/php-cgi
regards
create a index.php into public_html:
$ vim index.php
<?php
phpinfo();
?>
then if I go to web site, only see the text:
<?php
phpinfo();
?>
and not the result :(
if it worked then you should run the process /usr/bin/php-cgi as a user,for example ($ ps -ef f):
apache \_ /usr/sbin/httpd
user | \_ /usr/bin/php-cgi
regards
Re: Apache processes not running as user?
I commented /etc/httpd/conf.d/php.conf, now with phpfcgid template the web process of user runs as user, but the problem is that when open webmail roundcube is not work :( : http://subefotos.com/ver/?0b896d74aa117 ... b9c79o.jpg
Re: Apache processes not running as user?
There was a bug in installer and you might face it if you installed control panel before 19th december.
If it is the case then please try this:
If it is the case then please try this:
Code: Select all
yum install mod_fcgid
yum update vesta
cd /usr/local/vesta/data/templates/web/
wget http://c.vestacp.com/0.9.7/templates/web/apache_phpfcgid.sh -O apache_phpfcgid.sh
wget http://c.vestacp.com/0.9.7/templates/web/apache_phpfcgid.tpl -O apache_phpfcgid.tpl
wget http://c.vestacp.com/0.9.7/templates/web/apache_phpfcgid.stpl -O apache_phpfcgid.stpl
for user in $(v-list-sys-users plain); do v-rebuild-web-domains $user;done
Re: Apache processes not running as user?
I think it's a new bug, because I installed vesta after 19th december and these 3 files are identical to files that areskid wrote:There was a bug in installer and you might face it if you installed control panel before 19th december.
If it is the case then please try this:Code: Select all
yum install mod_fcgid yum update vesta cd /usr/local/vesta/data/templates/web/ wget http://c.vestacp.com/0.9.7/templates/web/apache_phpfcgid.sh -O apache_phpfcgid.sh wget http://c.vestacp.com/0.9.7/templates/web/apache_phpfcgid.tpl -O apache_phpfcgid.tpl wget http://c.vestacp.com/0.9.7/templates/web/apache_phpfcgid.stpl -O apache_phpfcgid.stpl for user in $(v-list-sys-users plain); do v-rebuild-web-domains $user;done
/usr /local/vesta/data/templates/web/
Re: Apache processes not running as user?
I solved the problem with roundcubemail, the config file (/etc/httpd/conf.d/roundcubemail.conf) now is like:
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule !prefork.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
Alias /roundcubemail /usr/share/roundcubemail
Alias /webmail /usr/share/roundcubemail
<Directory /usr/share/roundcubemail/>
AddType application/x-httpd-php .php
Order Deny,Allow
Deny from all
Allow from all
</Directory>
regards
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule !prefork.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
Alias /roundcubemail /usr/share/roundcubemail
Alias /webmail /usr/share/roundcubemail
<Directory /usr/share/roundcubemail/>
AddType application/x-httpd-php .php
Order Deny,Allow
Deny from all
Allow from all
</Directory>
regards
Last edited by Omar on Thu Jan 10, 2013 2:19 am, edited 1 time in total.
Re: Apache processes not running as user?
Thank you for workaroud Omar. I tried to reproduce this bug in my sand box, but I couldn't. So it's not clear to me why phpfcgi template didn't worked out. What you did was complete switch from mod_php to mod_fcgid, which is ok, but both modules should work together without problems. It looks like template triggerer didn't completed succsesfuly or it didn't even started.
When you create website vesta checks if there is shell script for chosen template and if it has execution flag.
So please make sure that file /usr/local/vesta/data/templates/web/apache_phpfcgid.sh is executable. You can also run it manualy as root any time, just replace $user $domain $ip $HOMEDIR $docroot variable with appropriate values.
When you create website vesta checks if there is shell script for chosen template and if it has execution flag.
Code: Select all
# Running template trigger
if [ -x $WEBTPL/apache_$template.sh ]; then
$WEBTPL/apache_$template.sh $user $domain $ip $HOMEDIR $docroot
fi
Code: Select all
/usr/local/vesta/data/templates/web/apache_phpfcgid.sh admin v-test.vestacp.com 127.0.0.1 /home /home/admin/web/v-test.vestacp.com/public_html
Re: Apache processes not running as user?
I checked everything.skid wrote:Thank you for workaroud Omar. I tried to reproduce this bug in my sand box, but I couldn't. So it's not clear to me why phpfcgi template didn't worked out. What you did was complete switch from mod_php to mod_fcgid, which is ok, but both modules should work together without problems. It looks like template triggerer didn't completed succsesfuly or it didn't even started.
When you create website vesta checks if there is shell script for chosen template and if it has execution flag.So please make sure that file /usr/local/vesta/data/templates/web/apache_phpfcgid.sh is executable. You can also run it manualy as root any time, just replace $user $domain $ip $HOMEDIR $docroot variable with appropriate values.Code: Select all
# Running template trigger if [ -x $WEBTPL/apache_$template.sh ]; then $WEBTPL/apache_$template.sh $user $domain $ip $HOMEDIR $docroot fi
Code: Select all
/usr/local/vesta/data/templates/web/apache_phpfcgid.sh admin v-test.vestacp.com 127.0.0.1 /home /home/admin/web/v-test.vestacp.com/public_html
The phpfcgi template work only when i comment the file /etc/httpd/conf.d/php.conf, if look this file, you can see:
Code: Select all
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Re: Apache processes not running as user?
Ok let's compare our setups. I will use user admin and domain v-test.vestacp.com in my example. After creating new domain with phpfcgi template I see following:
This is apache configuration /home/admin/conf/web/httpd.conf
As you can see there is additional handler "AddHandler fcgid-script .php" wich overrides setting in /etc/httpd/conf.d/php.conf
Ok now I will list file permissions:
and just in case wrapper content
Code: Select all
[root@v-test ~]# v-list-web-domain admin v-test.vestacp.com
DOMAIN: v-test.vestacp.com
IP: 67.43.11.16
IP6: NULL
U_DISK: 2
U_BANDWIDTH: 0
TPL: phpfcgid
ALIAS: www.v-test.vestacp.com
CGI: yes
ELOG: yes
STATS: NULL
STATS_USER: NULL
SSL: no
SSL_HOME: same
FTP_USER: NULL
NGINX: default
NGINX_EXT: jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,exe,pdf,doc,xls,ppt,txt,odt,ods,odp,odf,tar,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm
SUSPENDED: no
TIME: 08:15:38
DATE: 2013-01-09
This is apache configuration /home/admin/conf/web/httpd.conf
Code: Select all
<VirtualHost 67.43.11.16:8080>
ServerName v-test.vestacp.com
ServerAlias www.v-test.vestacp.com
ServerAdmin [email protected]
DocumentRoot /home/admin/web/v-test.vestacp.com/public_html
ScriptAlias /cgi-bin/ /home/admin/web/v-test.vestacp.com/cgi-bin/
Alias /vstats/ /home/admin/web/v-test.vestacp.com/stats/
Alias /error/ /home/admin/web/v-test.vestacp.com/document_errors/
SuexecUserGroup admin admin
CustomLog /var/log/httpd/domains/v-test.vestacp.com.bytes bytes
CustomLog /var/log/httpd/domains/v-test.vestacp.com.log combined
ErrorLog /var/log/httpd/domains/v-test.vestacp.com.error.log
<Directory /home/admin/web/v-test.vestacp.com/public_html>
AllowOverride AuthConfig FileInfo Indexes Limit
Options +Includes -Indexes +ExecCGI
php_admin_flag engine off
AddHandler fcgid-script .php
FCGIWrapper /home/admin/web/v-test.vestacp.com/cgi-bin/fcgi-starter .php
</Directory>
<Directory /home/admin/web/v-test.vestacp.com/stats>
AllowOverride All
</Directory>
Include /home/admin/conf/httpd.v-test.vestacp.com.conf*
</VirtualHost>
Ok now I will list file permissions:
Code: Select all
[root@v-test ~]# ls -all /home/admin/web/v-test.vestacp.com/cgi-bin/
total 12
drwxr-x--x 2 admin admin 4096 Jan 9 08:41 .
dr-xr-x--x 9 admin admin 4096 Jan 9 08:15 ..
-rwxr-x--x 1 admin admin 119 Jan 10 05:04 fcgi-starter
[root@v-test ~]# ls -all /home/admin/web/v-test.vestacp.com/public_html/
total 20
drwxrwx--x 2 admin admin 4096 Jan 10 05:24 .
dr-xr-x--x 9 admin admin 4096 Jan 9 08:15 ..
-rw-rw-r-x 1 admin admin 1059 Jan 9 08:15 index.html
-rw-rw-r-- 1 admin admin 22 Jan 9 08:16 index.php
-rw-rw-r-x 1 admin admin 65 Jan 9 08:15 robots.txt
Code: Select all
[root@v-test ~]# cat /home/admin/web/v-test.vestacp.com/cgi-bin/fcgi-starter
#!/bin/sh
PHPRC=/etc/
export PHPRC
export PHP_FCGI_MAX_REQUESTS=1000
export PHP_FCGI_CHILDREN=8
exec /usr/bin/php-cgi
Re: Apache processes not running as user?
I try to created a domain with admin user, but is return for all domain Error: domain test2.2o.cl exist (for example), is rare because a use a clean machine and new vesta install for this.
So a created a test user and packages, and now is work:
Ok, now a test domain:
The apache configuration:
The permissions:
The wrapper content:
Now a try:
Result:
And the process:
###################################################################################################
Ok, if look this file:
Now i comment the block with SetHandler:
Apache reload:
Result:
The process:
So a created a test user and packages, and now is work:
Code: Select all
[root@vesta ~]# v-list-user-package testpackage
PACKAGE: testpackage
TEMPLATE: phpfcgid
WEB_DOMAINS: 10
WEB_ALIASES: 10
DNS_DOMAINS: 10
DNS_RECORDS: 10
MAIL_DOMAINS: 10
MAIL_ACCOUNTS: 10
DATABASES: 10
CRON_JOBS: 10
DISK_QUOTA: 1000
BANDWIDTH: 10000
NS: vesta.inf.utfsm.cl,vesta.inf.utfsm.cl
SHELL: bash
BACKUPS: 10
TIME: 12:57:05
DATE: 2013-01-10
Code: Select all
[root@vesta ~]# v-list-user test
USER: test
FNAME: test
LNAME: test
PACKAGE: testpackage
TEMPLATE: phpfcgid
WEB_DOMAINS: 10
WEB_ALIASES: 10
DNS_DOMAINS: 10
DNS_RECORDS: 10
MAIL_DOMAINS: 10
MAIL_ACCOUNTS: 10
DATABASES: 10
CRON_JOBS: 10
DISK_QUOTA: 1000
BANDWIDTH: 10000
NS: vesta.inf.utfsm.cl,vesta.inf.utfsm.cl
SHELL: bash
BACKUPS: 10
CONTACT: [email protected]
CRON_REPORTS: yes
RKEY: 5wf5Av6fcG
SUSPENDED: no
SUSPENDED_USERS: 0
SUSPENDED_WEB: 0
SUSPENDED_DNS: 0
SUSPENDED_MAIL: 0
SUSPENDED_DB: 0
SUSPENDED_CRON: 0
IP_AVAIL: 1
IP_OWNED: 0
U_USERS: 0
U_DISK: 0
U_DISK_DIRS: 0
U_DISK_WEB: 0
U_DISK_MAIL: 0
U_DISK_DB: 0
U_BANDWIDTH: 0
U_WEB_DOMAINS: 0
U_WEB_SSL: 0
U_WEB_ALIASES: 0
U_DNS_DOMAINS: 0
U_DNS_RECORDS: 0
U_MAIL_DOMAINS: 0
U_MAIL_DKIM: 0
U_MAIL_ACCOUNTS: 0
U_DATABASES: 0
U_CRON_JOBS: 0
U_BACKUPS: 0
TIME: 10:00:47
DATE: 2013-01-10
Code: Select all
[root@vesta ~]# v-list-web-domain test test2.2o.cl
DOMAIN: test2.2o.cl
IP: 204.87.169.78
IP6: NULL
U_DISK: 0
U_BANDWIDTH: 0
TPL: phpfcgid
ALIAS: www.test2.2o.cl
CGI: yes
ELOG: yes
STATS: NULL
STATS_USER: NULL
SSL: no
SSL_HOME: same
FTP_USER: NULL
NGINX: default
NGINX_EXT: jpg,jpeg,gif,png,ico,svg,css,zip,tgz,gz,rar,bz2,exe,pdf,doc,xls,ppt,txt,odt,ods,odp,odf,tar,bmp,rtf,js,mp3,avi,mpeg,flv,html,htm
SUSPENDED: no
TIME: 10:02:36
DATE: 2013-01-10
Code: Select all
[root@vesta ~]# cat /home/test/conf/web/httpd.conf
<VirtualHost 204.87.169.78:8080>
ServerName test2.2o.cl
ServerAlias www.test2.2o.cl
ServerAdmin [email protected]
DocumentRoot /home/test/web/test2.2o.cl/public_html
ScriptAlias /cgi-bin/ /home/test/web/test2.2o.cl/cgi-bin/
Alias /vstats/ /home/test/web/test2.2o.cl/stats/
Alias /error/ /home/test/web/test2.2o.cl/document_errors/
SuexecUserGroup test test
CustomLog /var/log/httpd/domains/test2.2o.cl.bytes bytes
CustomLog /var/log/httpd/domains/test2.2o.cl.log combined
ErrorLog /var/log/httpd/domains/test2.2o.cl.error.log
<Directory /home/test/web/test2.2o.cl/public_html>
AllowOverride AuthConfig FileInfo Indexes Limit
Options +Includes -Indexes +ExecCGI
php_admin_flag engine off
AddHandler fcgid-script .php
FCGIWrapper /home/test/web/test2.2o.cl/cgi-bin/fcgi-starter .php
</Directory>
<Directory /home/test/web/test2.2o.cl/stats>
AllowOverride All
</Directory>
Include /home/test/conf/web/httpd.test2.2o.cl.conf*
</VirtualHost>
Code: Select all
[root@vesta ~]# ls -all /home/test/web/test2.2o.cl/cgi-bin/
total 12
drwxr-x--x. 2 test test 4096 ene 10 10:02 .
dr-xr-x--x. 9 test test 4096 ene 10 10:02 ..
-rwxr-x--x. 1 test test 119 ene 10 10:02 fcgi-starter
[root@vesta ~]# ls -all /home/test/web/test2.2o.cl/public_html/
total 16
drwxrwx--x. 2 test test 4096 ene 10 10:02 .
dr-xr-x--x. 9 test test 4096 ene 10 10:02 ..
-rw-rw-r-x. 1 test test 1045 ene 10 10:02 index.html
-rw-rw-r-x. 1 test test 65 ene 10 10:02 robots.txt
Code: Select all
[root@vesta ~]# cat /home/test/web/test2.2o.cl/cgi-bin/fcgi-starter
#!/bin/sh
PHPRC=/etc/
export PHPRC
export PHP_FCGI_MAX_REQUESTS=1000
export PHP_FCGI_CHILDREN=8
exec /usr/bin/php-cgi
Code: Select all
[root@vesta ~]# su - test
[test@vesta ~]$ id
uid=502(test) gid=502(test) groups=502(test) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[test@vesta ~]$ pwd
/home/test
[test@vesta ~]$ echo -e "<?php \n phpinfo(); \n?>" > web/test2.2o.cl/public_html/index.php
[test@vesta ~]$ cat web/test2.2o.cl/public_html/index.php
<?php
phpinfo();
?>
[test@vesta ~]$ ls -all web/test2.2o.cl/public_html/
total 20
drwxrwx--x. 2 test test 4096 Jan 10 10:30 .
dr-xr-x--x. 9 test test 4096 Jan 10 10:02 ..
-rw-rw-r-x. 1 test test 1045 Jan 10 10:02 index.html
-rw-rw-r--. 1 test test 23 Jan 10 10:33 index.php
-rw-rw-r-x. 1 test test 65 Jan 10 10:02 robots.txt
And the process:
Code: Select all
[root@vesta ~]# ps aux | grep test
root 19227 0.0 0.3 97828 3868 ? Ss 10:27 0:00 sshd: test [priv]
test 19231 0.0 0.1 97828 1908 ? S 10:27 0:00 sshd: test@pts/1
test 19232 0.0 0.1 110508 1952 pts/1 Ss+ 10:27 0:00 -bash
root 21046 0.0 0.0 105304 920 pts/0 S+ 11:08 0:00 grep test
Ok, if look this file:
Code: Select all
[root@vesta ~]# cat /etc/httpd/conf.d/php.conf
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule !prefork.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
#
# Cause the PHP interpreter to handle files with a .php extension.
#
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following lines to allow PHP to pretty-print .phps
# files as PHP source code:
#
#<FilesMatch \.phps$>
# SetHandler application/x-httpd-php-source
#</FilesMatch>
#
# Apache specific PHP configuration options
# those can be override in each configured vhost
#
php_value session.save_handler "files"
php_value session.save_path "/var/lib/php/session"
[root@vesta ~]# vim /etc/httpd/conf.d/php.conf
Code: Select all
[root@vesta ~]# vim /etc/httpd/conf.d/php.conf
[root@vesta ~]# cat /etc/httpd/conf.d/php.conf
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule !prefork.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
#
# Cause the PHP interpreter to handle files with a .php extension.
#
#<FilesMatch \.php$>
# SetHandler application/x-httpd-php
#</FilesMatch>
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following lines to allow PHP to pretty-print .phps
# files as PHP source code:
#
#<FilesMatch \.phps$>
# SetHandler application/x-httpd-php-source
#</FilesMatch>
#
# Apache specific PHP configuration options
# those can be override in each configured vhost
#
php_value session.save_handler "files"
php_value session.save_path "/var/lib/php/session"
Code: Select all
[root@vesta ~]# /etc/init.d/httpd reload
The process:
Code: Select all
[root@vesta ~]# ps aux | grep test
root 19227 0.0 0.3 97828 3868 ? Ss 10:27 0:00 sshd: test [priv]
test 19231 0.0 0.1 97828 1908 ? S 10:27 0:00 sshd: test@pts/1
test 19232 0.0 0.1 110508 1952 pts/1 Ss+ 10:27 0:00 -bash
test 20250 0.0 1.2 335096 13152 ? Ss 10:47 0:00 /usr/bin/php-cgi
test 20252 0.0 0.7 335228 7580 ? S 10:47 0:00 /usr/bin/php-cgi
test 20253 0.0 0.5 335096 6120 ? S 10:47 0:00 /usr/bin/php-cgi
test 20254 0.0 0.5 335096 6120 ? S 10:47 0:00 /usr/bin/php-cgi
test 20255 0.0 0.5 335096 5192 ? S 10:47 0:00 /usr/bin/php-cgi
test 20256 0.0 0.5 335096 5192 ? S 10:47 0:00 /usr/bin/php-cgi
test 20257 0.0 0.5 335096 5192 ? S 10:47 0:00 /usr/bin/php-cgi
test 20258 0.0 0.5 335096 5192 ? S 10:47 0:00 /usr/bin/php-cgi
test 20259 0.0 0.5 335096 5192 ? S 10:47 0:00 /usr/bin/php-cgi
root 21029 0.0 0.0 105304 920 pts/0 S+ 11:06 0:00 grep test