Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

How to deny access for Subversion (svn) related files in Apache?

Answer:

To deny access for Subversion (svn) related files under Apache, add the following lines to the Apache configuration (httpd.conf)

<DirectoryMatch .*\.svn/.*>
    Deny From All
</DirectoryMatch>

And restart Apache to take effect.

# apachectl -k graceful

How to tell if Apache 2 is using prefork or worker MPM?

Answer:

If you are running in Red Hat Linux/ Fedora/ CentOS

# httpd -V
....
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
...

If you are running in Debian/ Ubuntu, you can use apache2 -V, which get the same output as above.

Installing Nginx in Ubuntu

Answer:

1. Using aptitude

# sudo aptitude install nginx

2. Start it

# sudo /etc/init.d/nginx start

3. Stop it

# sudo /etc/init.d/nginx stop

4. Restart it

# sudo /etc/init.d/nginx restart

Adding SSL suport in Nginx

Answer:

Assume you have got your certificate file (server.crt) from a CA, and you also have a private key (server.key).

1. Compile Nginx to support SSL

# ./configure --with-http_ssl_module

2. Add the following line in nginx.conf

server {
    server_name YOUR_DOMAINNAME_HERE;
    listen 443;
    ssl on;
    ssl_certificate /usr/local/nginx/conf/server.crt;
    ssl_certificate_key /usr/local/nginx/conf/server.key;
}

3. Restart Nginx

Reference: http://wiki.nginx.org/NginxHttpSslModule

How many worker_processes should I use in Nginx?

Answer:

In the Nginx configuration (nginx.conf), the default worker_processes is 1.

e.g.

worker_processes  1;

However, as nowadays most servers are multi-core/multi-processor machine, it is a waste to only use 1 worker process.

The recommended worker_processes is equal to the number of CPU cores, e.g. if you have a dual Quad Core server, you should set to 8.

worker_processes  8;