Category Archives: Apache

How to benchmark apache+php

This is to see whether you server is CPU-bound or RAM-bound. We have to stress it and see which one of those components gets saturated first. If that is the RAM, we can add easily more RAM. The amount of … Continue reading

Posted in Apache, PHP, System Administration | Leave a comment

Apache and mod_ssl – HTTPS

To check whether SSL is already loaded by your Apache: /usr/sbin/httpd -M If it is not, installed it. After installing it, you should see a file in /etc/httpd/conf.d and a corresponding LoadModule directive there or in the main Apache configuration … Continue reading

Posted in Apache | Leave a comment

Apache – Easy Benchmark

ab -n 1000 -c 5 http://mydomain.com/bench.htm makes 1000 separate requests for the same file with a concurrency (simultaneous requests) of 5

Posted in Apache, Benchmarch | Leave a comment

Apache – Create an Environment Variable to Use With PHP

Add this in your Apache configuration file: SetEnv ENVIRONMENT “dev” In this way, thanks to the SetEnv instruction, we have created some environment variables in Apache that can be used inside our PHP code. In our PHP script we can … Continue reading

Posted in Apache | Leave a comment

Secure PHP & Apache Configuration

PHP Disable error messages expose_php Off Check you can’t get info by doing telnet localhost 80 and then issueing: HEAD / HTTP/1.0 session.use_only_cookies = 1 allow_url_fopen Off [if you don’t really need the opposite] register_globals = Off magic_quotes_gpc = ??? … Continue reading

Posted in Apache, LAMP Server Setup, PHP, Security, Web Dev Security | Tagged | Leave a comment

Auth: Protect A Site With Password

Add this in the Apache configuration file: <Directory document_root_for_the_site > AuthType Basic AuthName “Restricted access area” AuthUserFile path_to_passwords_file Require user username1 username2 </Directory> The Require user parameter could have a list of usernames space-separated. Usually path_to_passwords_file is /etc/httpd/passwords If you … Continue reading

Posted in Apache, Security | Leave a comment

Apache Virtual Host Setting

Don’t forget to uncomment the line: NameVirtualHost *:80 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Check that DirectoryIndex directive contains: index.html index.htm index.php !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Typical setup for dev environment <VirtualHost *:80> DocumentRoot /var/www/html/example.com/dev/html ServerName dev.example.com <Directory /var/www/html/example.com/dev/html> AllowOverride All </Directory> AddDefaultCharset UTF-8 php_flag display_errors on php_flag … Continue reading

Posted in Apache | Leave a comment

Apache Tips

Checking the configuration file sintax before restarting the server: apachectl -t

Posted in Apache | Leave a comment

Htaccess File to Set register_globals Directive

Some hosting provider set register_globals to ON just for compatibility to old open source projects. In this case, you should be able to override that just putting this line in your .htaccess file: php_flag register_globals on

Posted in Apache, PHP | Leave a comment