Category: Ubuntu Server Configuration

  • Redirect www to non-www on Nginx

    How to redirect the www.domain.com version of your website to domain.com version on Nginx? Here is how. You basically have to make two server blocks. The block with your normal configuration should be the version you want, the version you want to redirect should have a simple rewrite rule alone. For example, to redirect www.vidyut.net…

  • Nginx: upstream timed out (110: Connection timed out)

    Error 110: Connection timed out while reading response header from upstream Sometimes a Nginx web server seems to load pages with php code with a lot of xml parsing really slowly. Often it doesn’t load or connection times out. This will be seen more on pages where the php code parses through large xml files…

  • Fix a broken mysql

    If your mysql seems broken and giving errors like: # service mysql start start: Job failed to start or ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) Or if you try to recreate databases with mysqlinstalldb: … … ERROR: 1 Can’t create/write to file ‘./mysql/db.frm’ (Errcode: 13) 041226 xx:xx:xx /usr/libexec/mysqld:…

  • Update/install fail: Server cannot access software repositories

    If you are trying to install something and the server waits forever after you answer yes to the update and it accesses the software repository… something like… apt-get update … details of packages … Need to get 83.7 MB of archives. After this operation, 237 kB disk space will be freed. Do you want to…

  • bash: add-apt-repository: command not found

    If you are trying to add a ppa repository and get the following error bash: add-apt-repository: command not found You need to install python-software-properties, like so apt-get install python-software-properties If you have python-software-properties installed and are still getting this error, there is some problem with the package. Uninstall and reinstall it. apt-get remove python-software-properties –purge…

  • Installing UFW – Uncomplicated Firewall on Ubuntu 12.04

    If you are one of those nerdy types and use iptables, ignore this. If you are like the rest of us Ubuntu users (nerdy in denial), UFW (Uncomplicated Firewall) provides a handy tool to configure your firewall. Here’s how to install. As root, type: apt-get install ufw If this can’t find the package, run apt-get…

  • How to install APC and fix “potential cache slam” problem

    APC is an Alternative PHP Cache or Opcode cache that speeds up performance dramatically by caching queries. How to install APC? apt-get install php5-apc or pecl install apc You will have to enble it in the php configuration. Add the following to your php.ini file extension=apc.so Alternatively, you could create a separate apc.ini file and…

  • WordPress: Problem happened with plugin upgrade – can’t delete old files

    When you get an error like this while updating, check file ownership. Chances are that you edited something in the backend and the plugin or theme files now being owned by another user, cannot be deleted by the server. If you have terminal access as root, type: chown -R www-data:www-data /path/to/wordpress/* Where www-data is the…

  • Varnish won’t start – Too many arguments (\…)

    So you set up Varnish. You really did everything right, but when you try to start it… root@www:/etc/apache2/sites-available# service varnish start * Starting HTTP accelerator varnishd [fail] SMA.s0: max size 512 MB. Too many arguments (\…) usage: varnishd [options] -a … and so on, and you have tried and tried to edit /etc/default/varnish till you’re…

  • OpenVZ and UFW

    So I found another problem area with the OpenVZ host and the Ubuntu Server. A good firewall is important for the safety of a server, but I, at least feel overwhelmed at the complexity and risk of messing things up very badly to directly touch iptables, and I have only done on rare occasions, and…