In this blog post, we learn how to map DSpace digital repository installed on a VPS/cloud server with a subdomain creating VirtualHost in the Nginx webserver.
Install Nginx web server.
sudo apt install nginx -y
Create an Nginx server block configuration file for the dspace.opensio.co.in subdomain.
sudo nano /etc/nginx/conf.d/dspace.opensio.co.in.conf
Fill in the configuration.
server {
listen 80;
server_name dspace.opensio.co.in;
access_log /var/log/nginx/dspace.opensio.co.in_access.log;
error_log /var/log/nginx/dspace.opensio.co.in_error.log;
root /opt/tomcat/webapps/;
client_max_body_size 100M;
location / {
return 301 /xmlui;
}
location /xmlui {
index index.jsp;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/xmlui;
proxy_redirect http://localhost:8080/xmlui http://dspace.opensio.co.in/xmlui;
proxy_buffering off;
proxy_store off;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 120;
}
}
Nginx configuration test.
sudo nginx -t
If there is no error. the following will be shown
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Restart Nginx.
sudo systemctl restart nginx
Browse http://dspace.opensio.co.in
Install SSL Let's Encrypt
Install certbot Let's Encrypt.
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
SSL request for dspace.opensio.co.in subdomain on Nginx.
sudo certbot --nginx -d dspace.opensio.co.in
(in this you will need to provide a valid email address and agree the T&C)
If the SSL install is successful, a message appears
Congratulations! You have successfully enabled https://dspace.opensio.co.in
DNS Setup
You need to create an A record in the DNS setup of your domain with your VPS/cloud server IP address from your domain management panel (eg: Go Daddy)
Browse https://dspace.opensio.co.in
Reference: