Which settings should you use in `/etc/apache2/enabled-sites/000-default to make content only executable and readable for the user in the given folder?

I have the following /etc/apache2/sites-enabled/000-default

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www       
             // I put here /var/www/codes unsuccessfully
             // I get this error when restarting Apache
             // waiting apache2: Could not reliably determine  
             // the server's fully qualified domain name, 
             // using for ServerName

        --- cut ----
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order deny,allow
                allow from all                 // not sure about this
        --- cut ---

My permissions at /var/www/codes

 4 drwxr-sr-x 3 root www  4096 2009-08-21 00:16 forms
 4 drwxr-sr-x 7 root www  4096 2009-08-21 00:16 handlers
 8 -rw-r--r-- 1 root www  5403 2009-08-22 00:43 index.php
  • 2
    I am having a hard time following what you (really want/are saying). I am sure others are having the same problem.
    – user1797
    Aug 21, 2009 at 22:09
  • 1
    It's not too clear to me either. But a couple of comments: (1) the setup you have does not itself allow malware onto your system. If there is a malicious CGI script in /usr/lib/cgi-bin, that script could allow malware on to the system, but that's not Apache's fault. The configuration as you have it is basically fine. (2) It is safe to share your IP address on ServerFault (unless you do not want anyone accessing your server). An IP address is not some sort of secret information that allows hackers special access; it's a basic identifier that anyone who will ever visit your site must have.
    – David Z
    Aug 21, 2009 at 23:24
  • @David: My problem is that I have no idea how to read logs to see if someone has had an access to my computer. I want to open only little my ports such that people can access the site, but not hack to my PC. Aug 21, 2009 at 23:29
  • @Masi: Learning how to read log files is dead simple - I'm sure you could do a Google search and get tons of information. Also: if you're talking about opening ports, it sounds like you mean to ask about a firewall, not Apache?
    – David Z
    Aug 22, 2009 at 4:32

1 Answer 1


If you only want people to be able to access apache, and nothing else then you need to use a firewall. You could use ufw - uncomplicated firewall to only allow port 80 in.

However it's not a big deal if you don't have a firewall on linux, since it's quite secure by default.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .