Archive for the ‘VPS’Category

Fixing problems in Apache with case-sensitive URLs

Windows or Mac servers treat file names as case-insensitive, so Index.html and index.html are the same file. In Linux/Unix servers this is not the case, these files would be different. So when we create a link that does not match the case of the file name, you get an error. This is a common problem when moving files from Windows/Mac to a Linux production server and your links include incorrect case.

The ideal solution is to go over the entire site and correct these mismatches. But this may take some time and usually one finds out about the problem when the site has been moved and the domain pointed to the new server, so the problem has to be fixed ASAP.

There is a quick solution thanks to Apache’s mod_speling. If you need Apache to check different versions of a file name requested, you can use CheckCaseOnly and CheckSpelling directives. Adding one of these directives in a .htaccess file in the root directory of your site instantly fixes most of these problems. An example of this configuration is:

CheckSpelling on

We need to note that this method delivers a performance hit. Apache will have to double check each request for spelling when it does not find the file right away. So let it be noted that this is a quick fix; long term it is recommended that you backtrack and correct all the links.

24

08 2010

New OS images available for VPS plans

We have some new images available and tested for VPS servers. These are available as an upgrade or you can select the image you want when you order.

  • Ubuntu 10.04
  • CentOS 5.5

On both OSes, you can choose 32 or 64 bit with PHP 5.3 or PHP 5.2 (always the latest version); or you can choose a standard installation with no custom packages.

We have also upgraded numerous packages inside the custom installations and have included MongoDB support for PHP.

If you want to upgrade your existing VPS to one of these images, open a support ticket. Some versions can be upgraded without needing to reinstall the entire VPS, but this is not always the case.

16

08 2010

Installing Redmine on VPS

Redmine is a web based application for project management built on Ruby on Rails. It has become quite popular these days; even with those of us that did not drink that Ruby on Rails Kool Aid. While our VPS hosting packages are fine tuned for running PHP applications, RoR runs really smoothly on our machines and you can readily install a Rails app on your VPS without interfering with your PHP side of things. While this tutorial was tested on our VPS hosting packages, it’s generic enough that it should work on any other VPS or dedicated server out there.

Installing Redmine in a VPS that has no Rails is still quite easy. Here is a quick guide:

Install Ruby and Rails

This is done in a few simple steps, first download the Ruby source code, uncompress it and compile it:

  1. Download the source code.
  2. uncompress by running the command:
    tar zxvf ruby-1.8.7-p174.tar.gz
  3. go into the new directory and run:
    ./configure
    make install

Download RubyGems package manager. RubyGems is the Ruby standard for publishing and managing third party libraries.

  1. Download the package
  2. uncompress it with: tar zxvf rubygems-1.3.6.tgz
  3. go into the new directory and run:
    ruby setup.rb
  4. Install Rails by running:
    gem install rails

Install Passenger

Passenger in an Apache module to serve Rails applications.

Installation steps:

  • run:
    gem install passenger
  • run:
    passenger-install-apache2-module
  • Configure Passenger by creating a file /etc/httpd/conf.d/rails.conf and putting this inside:
    LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
    PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.11
    PassengerRuby /usr/local/bin/ruby
  • Add a virtual host section for your application by adding a file /etc/httpd/conf.d/redmine.conf and putting inside:
    <VirtualHost *:80>
      ServerName redmine.example.com
      DocumentRoot /usr/local/redmine/public
      <Directory /usr/local/redmine/public>
        AllowOverride all
        Options -MultiViews
      </Directory>
    </VirtualHost>

And finally, Install Redmine

  1. Checkout the SVN repository:
    cd /usr/local/
    svn co http://redmine.rubyforge.org/svn/trunk redmine
  2. Configure MySQL, create the database and DB user:
    create database redmine character set utf8;
    create user 'redmine'@'localhost' identified by 'my_password';
    grant all privileges on redmine.* to 'redmine'@'localhost';
  3. Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for “production” environment. Example for a MySQL database:
    production:
      adapter: mysql
      database: redmine
      host: localhost
      username: redmine
      password: my_password
  4. Go into the redmine directory and generate the session store secret by running:
    rake generate_session_store
  5. Generate the DB structure by running:
    RAILS_ENV=production rake db:migrate
  6. Insert the DB default data by running:
    RAILS_ENV=production rake redmine:load_default_data
  7. Go into public and run:
    cp dispatch.rb.example dispatch.rb
    chmod a+x dispatch.rb
    mv .htaccess .htaccessbak

Testing your installation

When all these is complete, test your Apache configuration by running:

/etc/init.d/httpd configtest

If no errors were found, restart Apache:

/etc/init.d/httpd restart

Load your redmine installation and login with admin / admin.

Tags: , ,

29

03 2010

PHP 5.3.2 released!

The PHP development team today released PHP 5.3.2 which includes many bug fixes, added some security improvements and implemented many more changes. You can go to the PHP site and download it right away from your preferred mirror, but if you are a ServerGrove VPS customer you can open a support ticket and we will upgrade it for you. If you plan to get a VPS with PHP 5.3 make sure to select the 5.3 version when you place your order and we will install the latest version.

As is the case with any upgrade, some applications may not run with PHP 5.3 so make sure your site or application is ready for the upgrade. The benefits of upgrading to PHP 5.3 are plenty, lots of new features and significant speed and memory management improvements which is big by our book.

Some PHP applications already require PHP 5.3, the most known ones are Symfony 2.0 and Lithium. If you need to develop with PHP 5.3, we recommend you to take a look at Zend Server CE 5.0 for your development environment, which we just wrote a blog post about it.

Tags:

05

03 2010

Dedicated IP now on all VPS 100 accounts

We are continually trying to improve our products and beginning this week a dedicated IP will be included with all VPS 100 accounts. If you are an existing VPS 100 customer you may request a dedicated IP at no additional cost by opening a support ticket. Keep in mind that your domain will have to be updated to point to the new IP address. This is really easy if you are already using our DNS servers.

Additional IPs for your VPS may still be purchased at $2 p/mo, as long as you provide a valid justification.

About the VPS 100

The VPS 100 is our entry level VPS offering 10GB Disk space, unlimited domains, 100GB data transfer, 256mb RAM burstable to 512MB. For $20 a month it is one of the best VPS offerings on the market fine tuned for running PHP frameworks & applications. It also includes DNS and Email service hosted in our servers outside your VPS so all the resources are used for your website hosting. For more information visit servergrove.com/vps

Tags:

08

12 2009

VPS hosting PCI-compliance ready

The Payment Card Industry Data Security Standard (PCI-DSS) is gaining momentum. It requires merchants (and providers) to “use strong cryptography and security protocols such as SSL/TLS or IPSEC to safeguard sensitive cardholder data during transmission over open, public networks.” when dealing with credit card numbers and account information.

One aspect of securing the data is the encryption of the communication between the browser (client) and the server. Most of our customers use Apache web server, and by default, this lets clients use weak encryption protocols and ciphers, mainly for backward compatibility with old browsers.

We recommend our customers to include these Apache configuration directives in their ssl.conf file. In fact, all our VPS images include this by default:


# use strong SSL protocols, specially do not enable SSLv2
SSLProtocol -ALL +SSLv3 +TLSv1

# Do not accept weak SSL ciphers from clients.
SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM

If you own a SSL certificate, you can test it along with the server configuration using this excellent service from SSL Labs.

To know more about our VPS offering for ecommerce follow this link.

22

07 2009

How to install an SSL certificate on Apache

In order to install a SSL certificate on a CentOS Virtual Server, make sure your plan includes a dedicated IP address. If it does not, contact us so we can assist you with adding one to your account.

To install the SSL certificate follow these steps:

  1. Create a file /etc/httpd/conf.d/cert.key and place the content of the certificate key in it. It will look like (with more lines):

    —–BEGIN RSA PRIVATE KEY—–
    MIICXgIBAAKBgQDsvYWqOtJBR+j15pCITwyM48Cp3rBArdJOsOjoFrU2CXiDpYAb
    4ZiA3CD+wTQtod+3aeRTAkEAuXfD0NSgcTYsqHS+HHUyDZifrjZBPhBNL4ONAvof
    ReXZzngKgFTGhfUm0Ypu6QVTRHit+Miv+AyY72KCUsN4/A==
    —–END RSA PRIVATE KEY—–

  2. Create a file /etc/httpd/conf.d/cert.crt and place the content of the certificate in it. It will look like (with more lines):

    —–BEGIN CERTIFICATE—–
    MIIDODCCAqGgAwIBAgIDC+KlMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT
    MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0
    UeHR9A2VwXvIbcrxYoLLFZraqI56CNwRCNIsUB9Z9k+6Y0J+A2iRo75Ws2cHPAMc
    97keASGvyDZy1w9W
    —–END CERTIFICATE—–

  3. Edit /etc/httpd/conf.d/ssl.conf and change SSLCertificateKeyFile and SSLCertificateFile directives so they point to the files listed in 1 and 2.

    SSLCertificateFile /etc/httpd/conf.d/cert.crt
    SSLCertificateKeyFile /etc/httpd/conf.d/cert.key

  4. Restart apache by running service httpd restart

15

07 2009

New PHP 5.3 VPS image available

If you follow PHP news closely, you probably know that today is an important day. PHP 5.3 has been released, featuring some big new features in development for quite some time. Because we know how important is to take advantage of new features, we configured a new VPS image with PHP 5.3.

If you plan to purchase a VPS hosting plan with PHP 5.3, make sure you select the right version in the order form so our provisioning system selects the right image. If you are a current customer and want to run PHP 5.3, let us know and we will help you upgrade free of charge. Please make sure that your applications are PHP 5.3 ready by reading the upgrade guide.

Additionally, our VPS image includes the following software:

  • CentOS 5.3 & Ubuntu 8.10
  • Apache 2.2
  • MySQL 5.1.35
  • PHP 5.3.0
  • APC 3.1.2
  • memcached & memcache PHP extension
  • symfony 1.2.x (older versions are also available)
  • Zend Framework 1.8.4
  • many more.

30

06 2009

Symfony 1.2.4 and Zend Framework 1.7.4 available at ServerGrove

Just a few minutes ago Symfony 1.2.4 was released, fixing several bug fixes.

Additionally, we upgraded Zend Framework to 1.7.4.

All our shared hosting servers have been upgraded. If you have a VPS or dedicated server and want automated upgrades of our PHP library add this to your /etc/crontab file:

0 4 * * * root    cd /usr/local/php; git pull > /dev/null

That’s it!

04

02 2009

Combining Symfony and Zend Framework

During the creation of a web application, on many occasions it is necessary to do something that requires the use of an external library.

If you happen to be building your web application using symfony, it is possible to use parts of the Zend Framework (and other frameworks and libraries) independently. This enables a whole new world of features with no preset limits.

At ServerGrove we use symfony for many of our projects, and also use Zend Framework since it provides many great components. This is why, we are always up to date on both frameworks and you will get excellent technical support when hosting your framework based sites with us.

So, as an example, you can use Zend_Mail to send emails from symfony. Some other components that are very useful in the symfony world are:

- Zend_Currency
- Zend_Mime
- Zend_Ldap
- Zend_Http
- Zend_OpenId
- Zend_Pdf

And the list goes on.

But going back to the Zend_Mail example, first, we need to tell symfony where to find the Zend Framework library.

All our servers here at ServerGrove come with not only symfony pre-installed but also we have all latests Zend Framework releases. It will be located at /usr/local/php/Zend. This will always be the latest stable version. If you need to use a specific version of the framework (to avoid possible future compatibility issues) you can also link to a specific version, for example /usr/local/php/ZendFramework-1.7.0/library

So, we need to modify the file config/ProjectConfiguration.class.php so we can use the autoloader provided by ZF, it should look like this:


// config/ProjectConfiguration.class.php
class ProjectConfiguration extends sfProjectConfiguration
{
static protected $zendLoaded = false;

static public function registerZend()
{
if (self::$zendLoaded)
{
return;
}

$zflib = '/usr/local/php/Zend';

set_include_path($zflib.PATH_SEPARATOR.get_include_path());
require_once $zflib.'/Loader.php';
Zend_Loader::registerAutoload();
self::$zendLoaded = true;
}

// ...
}

Then when we need to send the email, usually in an action, this is what we do:


ProjectConfigation::registerZend();
$mail = new Zend_Mail();
$mail->setBodyText('Message body');
$mail->setFrom('me@example.com', 'My name');
$mail->addTo($recipientEmail);
$mail->setSubject('Subject');
$mail->send();

That’s it. Could not be simpler! As we said, this opens many possibilites by using external libraries and avoids reinventing the wheel. By using the set of libraries and frameworks we provide on ServerGrove, it has never been easier to develop and run powerful and professional websites.

25

01 2009