Tag Archives: web server

Let’s Encrypt Cert & Nginx (Using a Web Proxy) on Centos 6.x

This was done on Centos 6 where prebuilt ‘certbot’ packages are not available. On Centos 7, install ‘certbot’ from the EPEL repo.

cd ~root;
mkdir certbot;
wget https://dl.eff.org/certbot-auto;
chmod 755 certbot-auto;
./certbot-auto;

This installs packages, including gcc, which you may want to uninstall as it’s bad practice to have compilers on a external facing (public) Web server.

On my server I have a different configuration file for each server we’re proxying for. These are in /etc/nginx/conf.d/ and using a naming convention of:

domainname.domain.conf

For example, example.com would be:

example.com.conf

Edit your config file and add this after location / { … } :

location /.well-known {
alias /tmp/static/.well-known;
}

Then:

mkdir /tmp/static/;

Run certbot:

./certbot-auto certonly

Continue reading Let’s Encrypt Cert & Nginx (Using a Web Proxy) on Centos 6.x

404 Errors On Pagespeed Generated JS & CSS

To improve performance of the SBGrid Web site I’ve been using Google’s Pagespeed Module for Apache. There is a module available for both Apache & NGinx, and  it can improve the performance of a Web site using a number of methods such as minimizing the number of JavaScript and CSS files that need to be downloaded.

We were seeing random 404 errors on Google Pagespeed auto-generated JavaScript and CSS files on the SBGrid’s Web site. These would only occur after the Web server was running for 2 days or more.

The fix for us was to increase Pagespeed’s caches and to give the host (it’s a VM) more RAM.

These are the values that we set:

  • ModPagespeedFileCacheSizeKb
    • Set the target size (in kilobytes) for file cache.
  • ModPagespeedLRUCacheKbPerProcess
    • Set the total size, in KB, of the per-process in-memory LRU cache.
  • ModPagespeedLRUCacheByteLimit
    • Set the maximum byte size entry to store in the per-process in-memory LRU cache.

This is what we set them to:

ModPagespeedFileCacheSizeKb 102400
ModPagespeedLRUCacheKbPerProcess 1024
ModPagespeedLRUCacheByteLimit 16384

Use these with care and make sure that your host has enough RAM to fit everything into memory without paging.

Original Image from my Flickr Feed.

References:

 

Enable mod_perl on Debian, Ubuntu, & Other Linuxes.

To enable mod_perl with Apache2 on Debian & Ubuntu for all directories served up by Apache2, including user directories such as ~/public_html, add the following lines to /etc/apache2/sites-available/default

# enable mod_perl
    <Files ~ ".(pl|cgi)$">
           SetHandler perl-script
           PerlResponseHandler ModPerl::Registry
           Options +ExecCGI
           PerlSendHeader On
    </Files>

In a real production environment you probably don’t want to enable this for all directories that Apache2 serves up, but only from those directories you expect to run perl in.

Thanks to this thread on the Ubuntu Forums for the info.

Titled updated as per Ozkar’s suggestion.