Posts Categorized: apache

Apache: unable to open logs

In the annals of “Everyday is a learning day”. I have an Apache server hosting student websites, and the number of websites grew to over 700 within a day and Apache was complaining with error: unable to open logs It took a little while to narrow down the problem as I assumed there was a… Read more »

Nginx Reverse Proxy

centos logo

Using CentOS 6 I installed Nginx with: yum install nginx and amended the config file for the default website i.e. vi /etc/nginx/conf.d/default.conf With the following content: upstream backend_st { server st.domain.co.uk:80; } server { listen 123.123.123.123:8080; server_name frontend.domain.co.uk; include /etc/nginx/default.d/*.conf; access_log /var/log/nginx/log/lamp.eeecs.qub.ac.uk.access.log main; error_log /var/log/nginx/log/lamp.eeecs.qub.ac.uk.error.log; root /usr/share/nginx/html; index index.html index.htm; location / { proxy_pass http://backend_st;… Read more »

Set Default Theme in phpMyAdmin on CentOS

phpmyadmin

I have installed phpMyAdmin on CentOS 6 via the EPEL repository using: yum install phpMyAdmin I was asked to set the default theme from the new jazzy one to the traditional one. To do so I edited the phpMyAdmin config file. On CentOS this was at /etc/phpMyAdmin/config.inc.php but on other installations it may be under… Read more »

DigiCert Certificate Inspector on CentOS 6

DigiCert Certificate Inspector

Installation on CentOS Download the 64-bit RPM: wget https://www.digicert.com/certificate-inspector/agent-pkg/digicertagent-x64.rpm Install the package: rpm -ivh digicertagent-x64.rpm Register the Agent You will need your DigiCert credentials to register the agent: /usr/bin/digicertagent register -desc “MyORG AName” Scan an Server /usr/bin/digicertagent scan -include servername.domain.tld:443 -analyze   Amend the Apache SSL Configuration for POODLE Vulnerability In the file used to… Read more »

Keeping Services Alive with Monit

On CentOS install monit as follows: yum install monit Make sure it starts automatically: /sbin/chkconfig –levels 235 monit on The main configuration file is at /etc/monit.conf but this file loads in any files under /etc/monit.d which is where we will place our files. First comment out the following sections in /etc/monit.conf as we will be… Read more »

Image data does not exist. Please re-upload the image

I had this error message when uploading images in WordPress. Image dimensions were set to 0x0 and the thumbnails did not appear. A quick scan of the Apache logs PHP Warning:  copy(/var/www/vhosts/thedomain.com/httpdocs/wp-content/uploads/thephoto.jpg): failed to open stream: Permission denied in showed me that I needed to correct the permissions on the /wp-content/uploads directory to allow Apache… Read more »

LAMP Performance

The following scripts can help in determining good values for Apache and MySQL configurations based on the amount of memory available: MySQL Tuner Apache Tuner Apache Buddy The following will give  a list of Apache Modules loaded: apachectl -t -D DUMP_MODULES The following will give the memory usage of Apache: #!/bin/sh # apache_mem.sh # Calculate… Read more »

Apache Protect Multiple Locations

The configuration directive below is one I used to protect multiple URLs with a htpasswd file. So match (~) /url01/ or (|) /url02/ or (|) …. <Location ~ “/url01/|/url02/|/rfinlay1/|/cgribb5/|/lgrw01/|/ahll7/|/cki3/|/ele02/|/mm24/|/cmcc78/|/jmc8/|/gmc1/|/mmy82/|/eoa1/|/cs01/|/pr5/|/ln50/|/rc1/|/hd01/|/a05/|/e1/|/ss12/|/mm6/|/s75/|/gp01/” > AuthUserFile /etc/httpd/conf/.htpasswd-file AuthName “Restricted Access” AuthType Basic Require valid-user </Location>

Apache GeoIP Country Detection

Creating customised content based on the origin country of your website visitors requires installing the mod_geoip module for Apache and also the MaxMind GeoIP database as follows (on CentOS): mkdir ~/geoip cd  ~/geoip wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz tar xzf GeoIP* cd GeoIP* ./configure make make check make install cd .. wget http://geolite.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2_1.2.5.tar.gz tar xzf mod_geoip2_1.2.5.tar.gz cd mod_geoip2_1.2.5… Read more »

LAMP on Ubuntu

There are several different commands that can be used to install Apache and MySQL services with PHP support: sudo apt-get install tasksel && sudo tasksel sudo apt-get install lamp-server^ sudo apt-get install apache2 libapache2-mod-php5 php5 php5-cli php5-mysql php5-gd php5-mcrypt php5-curl mysql-client mysql-server libmysqlclient15-dev phpmyadmin   For number two the carat at the end is important.