Category: Apache

Install Apache on Debian and Ubuntu

Install Apache sudo apt-get install apache2 sudo vi /etc/apache2/sites-available/default change AllowOverride None > AllowOverride All in line 11 Enable Apache rewrite and restart Achtung! Don’t forget or things will not work and you’ll waste hours trying to find out why sudo a2enmod rewrite Restart Apache sudo service apache2 restart If no error, its working Optional: The following “example” is used...

Apache2 Invalid method in request \x16\x03\x01

Apache2 reports an error “Invalid method in request \x16\x03\x01” Check that the IP address is correct in line #8 of /etc/apache2/sites-available/www.example.com <VirtualHost *:80> ServerAdmin webmaster@seleads.com ServerName www.example.com ServerAlias example.com Redirect 301 http://example.com http://www.example.com/ DocumentRoot /var/www/www.example.com/ </VirtualHost> <VirtualHost 199.199.199.199:443> SSLEngine on ServerName example.com SSLCACertificateFile /etc/apache2/ssl/PrimaryRootCA.crt SSLCertificateChainFile /etc/apache2/ssl/Thawte_DV_SSL_CA_Bundle.crt SSLCertificateFile /etc/apache2/ssl/example.crt SSLCertificateKeyFile /etc/apache2/ssl/private/example.key DocumentRoot /var/www/www.example.com/ </VirtualHost>

How to Customize Apache Log Format for Fail2ban

Customize apache2 other_vhosts_access.log format so fail2ban can use it. sudo vi /etc/apache2/apache2.conf On line 255 insert LogFormat “%t %v:%p %h %l %u \”%r\” %>s %O \”%{Referer}i\” \”%{User-Agent}i\”” fail2ban Comment out the following line #LogFormat “%v:%p %h %l %u %t \”%r\” %>s %O \”%{Referer}i\” \”%{User-Agent}i\”” vhost_combined sudo vi /etc/apache2/conf.d/other-vhosts-access-log change the end of the line (or duplicate and comment out) as...

Fail2ban Apache2 Access Log Regex Fails

Changing banaction to ROUTE worked, while IPTABLES-ALLPORTS failed with error No Host Found 2014-09-26 10:55:24,662 fail2ban.filter : ERROR No ‘host’ found in ‘113.71.191.49 – – [ +0000] “GET /phpMyAdmin/scripts/setup.php HTTP/1.1” 500 833 “-” “-” ‘ using ‘‘ [apache-phpmyadmin-access] enabled = true #banaction = iptables-allports banaction = route port = http,https filter = apache-phpmyadmin-access logpath = /var/log/apache2/access.log maxretry = 0 #...

How to Enable PHP Error Logging

sudo vi /etc/php5/apache2/php.ini error_reporting = E_ALL | E_STRICT error_log = /var/log/php_errors.log You must create the (log) file manually touch /var/log/php_errors.log chown www-data: /var/log/php_errors.log chmod +rw /var/log/php_errors.log

How To Harden Debian Server

Its not enough to harden just Debain. Its necessary to harden the rest of Apache-MySQL-PHP as well. Harden MYSQL sudo mysql_secure_installation answer Yes to all questions (but no need to change password) Disabling SSH root login and settings sudo vi /etc/ssh/sshd_config change PermitRootLogin yes to PermitRootLogin no LoginGraceTime 120 to LoginGraceTime 30 add line AllowUsers username username username Consider disabling...

Fix Magento Missing Images In Checkout Cart

When moving a magento instance to a new server, it seems the product cache exhibits some very strange behavior making a fix to the new server almost impossible after the fact. That means the problem is an imprecise backup and transfer process. The problem seems to be a result of a mismatch between the database and some files (cache).

Apache Permissions on ServerRoot Directories

Apache Permissions on ServerRoot Directories In typical operation, Apache is started by the root user, and it switches to the user defined by the User directive to serve hits. As is the case with any command that root executes, you must take care that it is protected from modification by non-root users. Not only must the files themselves be writable...

FIND Command Usage Notes for Webmasters

File manipulation using FIND These examples are Ubuntu 12.04 and Apache2 FIND find a file by name # sudo find ~/ -name ‘banner3.jpg’ 2>/dev/null find and copy # combined to make a script to double filter sudo find /media/backup01/* -name ‘*.txt’ -exec cp {} ~/dump \; + increases speed sudo find . -name ‘*.py’ -exec grep –color ‘xrange’ {} +...

Setup SSL on Debian Apache Virtualhost

Assuming: Debian 7 Wheezy You have more than one website on your server (therefore you are using Virtualhost files for each website) You are on Apache2.2 https://www.debian-administration.org/article/349/Setting_up_an_SSL_server_with_Apache2 You should do this first : Generate SSL key, crt, csr files Apache SSL Setup (what they say and what I did not do): To enable SSL, type (as user root): sudo a2ensite...

9 Steps To Setup SSL on UBUNTU 12.04 APACHE 2.22

I found a lot of misleading and confusing How-To stuff when installing an SSL certificate on Ubuntu 12.04 LTS and Apache 2.22. I also share most people confusion when it comes to encryption. Only after a lot of repetition has the fog begun to clear. It helps to realize: The “key” is your PRIVATE file. Don’t ever share it. Its stays...

Apache Virtual Host Example

There are so many variation of how to setup Apache VirtualHost that its difficult for a beginner to figure it all out. Here is how I have found works best for a LAMP server that you own. If its not a standard Linux distro (Debian/Ubuntu here) all bets are off. sudo vi /etc/apache2/sites-available/www.example.com copy this code into the file <VirtualHost...

Whereis Apache on Ubuntu

One of the real problems is later finding where Apache puts the various files you need to manager Apache (in many different directories in Ubuntu). I can highly recommend Linode installations. Easy, fully functional, optimized, ready to go, LAMP stack. Apache Configuration Files Apache2 is configured by placing directives in plain text configuration files. These directives are in these directories:...

Setup Apache on Ubuntu Desktop

If you just need to use Apache on your Ubuntu Desktop as localhost, these notes apply. But see the other menu options for Ubuntu/Apache setup/care/feeding on a production server. Ubuntu Documentation for Installing and Configuring Apache/2.2.16 on Ubuntu/10.04 You may be looking for this instead > Install a Linode LAMP Server from scratch Install Apache on/from Ubuntu Desktop using Synaptic...