Small blog about system administration.

Wordpress Owner/Group/Permission Issues on Plesk

Log into Plesk and enable CGI/FastCGI support for your domain.
Go to the Domains tab, click on your domain, then on Setup. 
Make sure PHP support, CGI support, and FastCGI support are all selected.
Click OK to save your changes.
Log into your server with a root or sudo user via SSH.
Make a local copy of the PHP CGI binary program for your domain:
cp /usr/bin/php-cgi /var/www/vhosts/

Change the ownership of the bin directory and your new local copy of PHP:

chown -R domainuser:psacln /var/www/vhosts/

Modify or create your local Apache configuration file, vhost.conf:

vim /var/www/vhosts/ 

Add the following lines to the file:

AddHandler fcgid-script .php
SuexecUserGroup domainuser psacln
<Directory /var/www/vhosts/>
FCGIWrapper /var/www/vhosts/ .php
Options +ExecCGI +
FollowSymLinks allow from all

Reload your Apache configuration settings:

/usr/local/psa/admin/sbin/websrvmng -av

Restart Apache:

/etc/init.d/httpd graceful

PHP will now be running as FastCGI as the same user and group that owns your website files.

Adjust your sessions directory:

Since PHP will now be running as the script's user rather than apache, the permissions for the session folder need adjusted to account for this.

chmod 777 /var/lib/php/session

Adjust permissions:

Most CMS software will warn you about security risks related to permissions in the administrative panel somewhere. You probably don't need to run these commands if you're configuring a new domain or have just installed your CMS.

cd /var/www/vhosts/ && chown -R domainuser:psacln * && find . -type f -exec chmod 644 {} \; && find . -type d -exec chmod 755 {} \;

You should consider adjusting the number of simultaneous FastCGI processes allowed for each domain and for the server overall, based on the number of domains that you have running FastCGI. The default configuration allows 64 total processes and 8 per domain. Edit your configuration file:

vim /etc/httpd/conf.d/fcgid.conf

Update the following variables, if desired:

MaxProcessCount 64 
DefaultMaxClassProcessCount 8

You should set the DefaultMaxClassProcessCount to the number of processes you want a single domain to be able to run simultaneously. Multiply that number by the number of domains that are running FastCGI, and use that number for the MaxProcessCount. 
For example, if you have 4 domains using FastCGI, and you want them to run a maximum of 10 simultaneous processes each, you can set the following values:

MaxProcessCount 40 
DefaultMaxClassProcessCount 10 

Do not set these values arbitrarily high, as this may interfere with your server's memory usage. 
Alternately, you can pick a server maximum first for the MaxProcessCount, and then divide by the number of your domains to set the DefaultMaxClassProcessCount value.

No comments :

Post a Comment