How to deploy searchcode server behind nginx

If you want to have a public facing searchcode server instance it is suggested that you deploy behind a reverse proxy such as nginx. The main reason being that you can easily attach SSL certificates and it will help protect searchcode server from excessive load.

The below is an example config that could be used for nginx to reverse proxy back to searchcode.

upstream searchcode_app_server {
    server localhost:8080;
}

server {

    listen   80;

    server_name yoursearchcodeinstance.com;

    access_log /tmp/nginx-access.log;
    error_log /tmp/nginx-error.log;

    server_tokens off;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://searchcode_app_server;
    }
}

If you do deploy searchcode server as such you should also change the searchcode.properties file setting only_localhost=false to only_localhost=true to prevent users being able to hit searchcode on the default port of 8080.

Productivity through code search.

Try searchcode server for Free