Apache httpd hardening
Introduction
Apache is one of the most widely-used and popular web servers. It is also one of the most secure web servers available. In this article, I will explain some tips and tricks that will secure your Apache server.
This is a generic ‘quick n dirty’ hardening profile.
Hide version:
1 2 |
ServerSignature Off ServerTokens Prod |
Turn Off Server-Side Includes …Read More
htaccess https simple redirect
How to redirect HTTP traffic to HTTPS using an .htaccess file
The below code when added to an .htaccess file will automatically redirect any traffic destined for http: to https:
1 2 3 4 5 |
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] </IfModule> |
This is generic code, no domain or page or subfolder needed in the htaccess code.
Common HTTP Error codes and fixes
Here’s a list with the most common HTTP error codes and solutions for each one.
Error 500: Internal Server Error
Cause 1: Syntax error in .htaccess
Cause 2: Invalid files/directories permissions
Other causes
Errors 502: Bad Gateway & 504: Gateway Timeout
Error 503: Service Unavailable
Error 508: Resource Limit Is Reached
Error 500: Internal Server Error
Error 500
Cause 1: …Read More
Protecting Apache Server From Denial-of-Service Attacks
Protecting Apache Server From Denial-of-Service Attacks
Denial-of-Service (DoS) attack is an attempt to make a machine or network resource unavailable to its intended users, such as to temporarily or indefinitely interrupt or suspend services of a host connected to the Internet. A distributed denial-of-service (DDoS) is where the attack source is …Read More
Centos 7 Configure Django with Apache
Django is a high-level and powerful Python Web framework. In fact, this tool will help to make rapid development and concrete design. It is free and open source application that can help you to have your python application and website rapidly.
What Is Django?
Django was created at the end of 2003 …Read More
Check / Determine Your Version of Tomcat and Java
Determine Your Version of Tomcat using console
Linux:
java -cp lib/catalina.jar org.apache.catalina.util.ServerInfo
Windows:
java.exe -cp lib\catalina.jar org.apache.catalina.util.ServerInfo
The output should be similar to this:
java -cp catalina.jar org.apache.catalina.util.ServerInfo
Server version: Apache Tomcat/7.0.42
Server built: Jul 18 2014 10:08:19
Server number: 7.0.42.0
OS Name: Linux
OS Version: 2.6.32-531.29.2.lve1.3.11.1.el6.x86_64
Architecture: amd64
JVM Version: 1.7.0_75-mockbuild_2015_01_22_07_15-b00
JVM Vendor: Oracle Corporation
Location of catalina.jar in cPanel server is:
/usr/local/easy/share/java/easy-tomcat7
Determine Your Version …Read More
Enable Apache UserDir In CentOS 7 / RHEL 7 with SELinux
Lets show you how to install userdir for Centos 7 with Selinux Enabled. In this method all users should have their own public_html directory.
1. Go to root user
1 |
su - root |
2. Create /etc/httpd/conf.d/userdir.conf file
Install apache:
1 |
yum install httpd -y |
Enable Apache Userdirs
1 |
vi /etc/httpd/conf.d/userdir.conf |
add:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<IfModule mod_userdir.c> # # UserDir is disabled by default since it can confirm the presence # of a username on the system (depending on home directory # permissions). # UserDir enabled nixpal # # To enable requests to /~user/ to serve the user's public_html # directory, remove the "UserDir disabled" line above, and uncomment # the following line instead: # UserDir public_html </IfModule> <Directory /home/*/public_html> Options Indexes Includes FollowSymLinks ##For apache 2.2,Please use: AllowOverride All Allow from all Order deny,allow #For apache >= 2.4,Please use : Require all granted </Directory> |
Restart apache
1 |
systemctl restart httpd.service |
Then create user’s public_html and assign permissions.
1 |
mkdir /home/nixpal/public_html |
1 |
chmod 711 /home/nixpal |
1 |
chown nixpal:nixpal /home/nixpal/public_html |
1 |
chmod 755 /home/nixpal/public_html |
Then here’s the other new things, especially you are using …Read More
Install LAMP Server (Apache, MySQL or MariaDB, PHP) On Ubuntu 14.10/14.04/13.10
LAMP is a combination of operating system and open-source software stack. The acronym LAMP comes from the first letters of Linux, Apache HTTP Server, MySQL or MariaDB database, and PHP/Perl/Python.
In this tutorial, we will see how to setup LAMP server on Ubuntu 14.10 system.
Install Apache
Apache is an open-source multi-platform web …Read More
CentOS and RHEL 7: Install Linux, Apache, MariaDB, PHP (LAMP)
More about LAMP
LAMP is nothing but a software bundle or a platform consisting of Linux operating system, Apache web-server, MySQL database server and PHP (or Perl/Python)scripting language. The LAMP stack is used for building heavy-duty dynamic web sites entirely out of free and open-source software. In this tutorial, I’m going …Read More