Setup Solr Admin web interface in Nginx

This article will guide on setting up Solr Admin web interface in Nginx. If you haven't installed Solr in your system, please check this article Step by step guide to setup Apache Solr 5.x in CentOS 7 for Drupal 7 Panopoly distro using Search API. Please follow this guide if you haven't setup your Nginx yet.

  1. Create a domain for Solr, in this guide lets use solr.mywebsite.com. Go to DNS manager and add "solr" as A record for mywebsite.com

  2. Now, lets create nginx configuration for solr.mywebsite.com:

          
    vi /etc/nginx/sites-available/admin/solr.mywebsite.com.conf
          
        

    ... and have the following script as its content:

          
    server {
      listen XXX.XXX.XXX.XXX:80; # IPv4
      listen [XXXX:XXXX::XXXX:XXXX:XXXX:XXXX]:80; # IPv6
      server_name solr.mywebsite.com;
      
      location / {
        proxy_pass http://127.0.0.1:8983;
        auth_basic "Restricted";
        auth_basic_user_file /etc/nginx/key/.htpasswd-users;
      }
    }
          
        

    Note: Change the XXX.XXX.XXX.XXX and XXXX:XXXX::XXXX:XXXX:XXXX:XXX with your server's IPv4 and IPv6 addresses respectively.

  3. Create symbolic link for solr.mywebsite.com.conf in /etc/nginx/sites-enabled/ to enable this configuration:

          
    ln -s /etc/nginx/sites-available/admin/solr.mywebsite.com.conf /etc/nginx/sites-enabled/solr.mywebsite.com.conf
          
      
  4. Add password protection to solr.mywebsite.com:

          
    htpasswd /etc/nginx/key/.htpasswd-users admin
          
          

    This command will prompt password for the new user with the name admin.

  5. Restart nginx:

          
    systemctl restart nginx
          
      
  6. You can now access your Solr Admin web interface at http://solr.mywebsite.com and this should challenge you with password.

Tags

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.