web analytics

Monthly Archives November 2013

Password Protecting a Site in nginx

This post will explain how to password protect a site in nginx. It is very simple and it uses the normal htpasswd protection

Suppose I need to password protect the site greproot.com whose document root is /var/www/greproot/public_html

Simple follow the steps given below

[root@abc ~]#  cd /var/www/greproot/public_html

[root@abc ~]#  htpasswd -c .htpasswd admin        where admin is the username chosen. It will prompt for password, give a strong password.

Now, your login details are stored to the file /var/www/greproot/public_html/.htpasswd and we need to call this file from greproot.com’s conf.

Simply add the following two lines before the locations

[root@abc ~]# cd /etc/nginx/sites-available/

[root@abc ~]# vi greproot.com

auth_basic “Restricted”;
auth_basic_user_file /var/www/g...

Read More

Adding domains under nginx

You can install nginx webserver as mentioned in this link

Now to add domains to it, we create two folders for the virtualhosts.

1) sites-available for all virtualhosts

2) sites-enabled for those virtualhosts that are active

We are going to create the domain greproot.com with username as greproot

The document root will be under /var/www/greproot/public_html. So create a user with home directory set to /var/www/greproot

[root@abc ~]# useradd -d /var/www/greproot  greproot

[root@abc ~]# passwd greproot                      # give a strong password for the user

[root@abc ~]# mkdir /var/www/greproot/public_html

[root@abc ~]# mkdir /var/www/greproot/logs

[root@abc ~]# touch /var/www/greproot/logs/access.log

[root@abc ~]# touch /var/www/greproot/logs/error.log

[root@abc ~]# chown -R...

Read More

Extend partitions in 1&1 dedicated servers

1&1 dedicated servers comes with pre-configured partitions which are too small in size. If you are to host websites, create databases etc, you should definitely extend those partitions, or you will soon be flooded with low disk space warnings.

This post will tell you how you can increase the partition size. In the example I consider here, the server has two disks with 1.5T space each. The server has RAID1, which means the total usable space is 1.5T. This is how my partitions are currently.


[root@abc ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md1              4.0G  615M  3.4G  16% /
/dev/mapper/vg00-usr  4.0G  1.3G  2.5G  35% /usr
/dev/mapper/vg00-var  4.0G  334M  3.5G   9% /var
/dev/mapper/vg00-home
4.0G  136M  3...
Read More

Install nginx webserver in Centos6 server

You can install nginx webserver in Centos6 server with yum. It is simple and easy. Follow the steps given below.

First we need to install the nginx repo

[root@abc ~]# cd /etc/yum.repos.d/

[root@abc yum.repos.d]# wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

[root@abc yum.repos.d]# rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm

Make sure that the repo nginx.repo is listed at /etc/yum.repos.d. Once it is done, you can install nginx using yum

[root@abc yum.repos.d]# yum install nginx

The nginx configuration file is available at /etc/nginx/nginx.conf. You need to update the worker process in it. The worker process can be equal to the number of CPUs in the server.

[root@abc ~]# cat /proc/cpuinfo  | grep processor | wc -l

8

The above ...

Read More

Error: Missing Dependency: python(abi) = 2.6 is needed by package s3cmd-1.0.0-4.1.x86_64 (s3tools)

I was trying to install s3cmd in my centos6 server when i got the following error.

s3cmd-1.0.0-4.1.i386 from s3tools has depsolving problems —> Missing Dependency: python(abi) = 2.6 is needed by package s3cmd-1.0.0-4.1.i386 (s3tools)
s3cmd-1.0.0-4.1.x86_64 from s3tools has depsolving problems —> Missing Dependency: python(abi) = 2.6 is needed by package s3cmd-1.0.0-4.1.x86_64 (s3tools)
Error: Missing Dependency: python(abi) = 2.6 is needed by package s3cmd-1.0.0-4.1.x86_64 (s3tools)
Error: Missing Dependency: python(abi) = 2.6 is needed by package s3cmd-1.0.0-4.1.i386 (s3tools) You could try using —skip-broken to work around the problem

If you are getting python dependency issues with s3cmd tools in centos6, please instal EPEL repo and it will solve it.

wget http://dl...

Read More

IIS7 file upload limit of 30M

I had wordpress setup for one of my domains in a windows 2008 server with IIS7. All files uploads upto 30M was working fine, but more than that no luck. Then I read that IIS7 has a default upload limit of 30M. I had to do two things to get it working. Details given below.

Click Start -> Internet Information Services Manager

Click on the webserver name to highlight it(in order to make changes globally) or just click on your website name to enable changes for that site alone.

On features view, scroll down to IIS -> Request Filtering.

On the right pane, click on Edit Feature Settings

Look for the field “Maximum Allowed Content Length”. It will be the default value of 30000000

Change the value to 104857600 which is 100M.

Save the changes and restart IIS(usually a restart is not needed)

Now...

Read More

***** FATAL: Could not write to /etc/yum.conf

Sometimes while running upcp in a cpanel server, you may encounter the following error and upcp will quit.

***** FATAL: Could not write to /etc/yum.conf

Check if any attributes are set for /etc/yum.conf.

You can check it by issuing the following command.

[root@abc ~]# lsattr /etc/yum.conf
—-i——–e- /etc/yum.conf

If you see an ‘i’  in the output as seen above, then issue the following command to release the attribute.

[root@abc ~]# chattr -i /etc/yum.conf

Now double check that the attribute is gone by issuing lsattr again.

[root@abc ~]# lsattr /etc/yum.conf
————-e- /etc/yum.conf

Read More

‘httpd’ is disabled via ‘/etc/apachedisable’, please re-enable to continue

If you get the following error while running easyapache in a cpanel server, it means httpd is not enabled in service manager.

‘httpd’ is disabled via ‘/etc/apachedisable’, please re-enable to continue

To correct it, do the following.

Login to WHM

Go to Service Configuration -> Service Manager

Check ‘enabled’ and ‘monitor’ for the service httpd

Save

Now try running easyapache again.

Read More

Fantastico Showing blank page

When you access fantastico from cpanel, if it is displaying a blank page, it can be fixed easily.

Login to WHM -> Tweak Settings -> PHP -> cPanel PHP loader.

Check ioncube as the cpanel PHP loader and save the changes.

Now refresh your fantastico page and enjoy 🙂

Read More