Blog
Nginx / Apache switch?
Now easier with user setting for Nginx

Nginx on a VPS – user trick

As we know, Nginx is faster than Apache to serve static files. Recently CodeAndMore installs nginx as its default however we met difficulty with “nginx” user, which is different than WHM – Apache – PHP user. Difficult to backup by Cpanel, harder to upload files via SFTP etc…

Until we found that it is possible to change user that Nginx runs on. Assume your Cpanel account user is ucpanel (replace this with your Cpanel username).

nano /etc/nginx/nginx.conf

Change it from user nginx; to user ucpanel;

Then restart Nginx:

service nginx restart

nginx runs with fastcgi, php-fpm so we will need to change user that fastcgi runs on too.

If you use scripts from Linode then:

nano /usr/bin/php-fastcgi

Replace nginx with ucpanel

Then kill the fastcgi process and start it again:

/etc/init.d/php-fastcgi start

Now Nginx runs as normal Cpanel user, we can assign its root folder to /home/ucpanel/public_html and switch Apache / Nginx much easier, also full Cpanel backup much easier too.

Enjoy!.

Comments

Leave a Reply

You must be logged in to post a comment.

Facebook Fans