This guide provides step-by-step manual installation instructions for the URI XML Search system.
- Python 3.8+
- Apache with mod_wsgi OR Nginx with uWSGI
- Git
- Virtual environment (recommended)
- Root/sudo access to the server
sudo dnf update -y # or 'yum' for AL2
sudo dnf install -y python3 python3-pip python3-devel httpd httpd-devel gcc git
sudo pip3 install mod_wsgisudo mkdir -p /var/www/uascsearch
cd /var/www/uascsearch
sudo git clone https://github.com/uri-libraries/uascsearch.git .sudo python3 -m venv venv
sudo venv/bin/pip install --upgrade pip
sudo venv/bin/pip install -r requirements.txtsudo chown -R apache:apache /var/www/uascsearchsudo cp /var/www/uascsearch/.env.template /var/www/uascsearch/.env
sudo nano /var/www/uascsearch/.env# Generate a strong secret key
SECRET_KEY=$(python3 -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())')
# Edit .env file
SECRET_KEY=your-generated-secret-key-here
DEBUG=False
ALLOWED_HOSTS=your-domain.com,www.your-domain.com,your-server-ip
CORS_ALLOWED_ORIGINS=https://your-wordpress-site.comcd /var/www/uascsearch
# Run migrations
sudo -u apache venv/bin/python manage.py migrate
# Create superuser (optional)
sudo -u apache venv/bin/python manage.py createsuperuser
# Collect static files
sudo -u apache venv/bin/python manage.py collectstatic --noinputCreate configuration:
sudo nano /etc/httpd/conf.d/uascsearch.confAdd configuration:
<VirtualHost *:80>
ServerName your-domain.com
ServerAlias www.your-domain.com
DocumentRoot /var/www/uascsearch
WSGIDaemonProcess uascsearch python-path=/var/www/uascsearch python-home=/var/www/uascsearch/venv user=apache group=apache
WSGIProcessGroup uascsearch
WSGIScriptAlias / /var/www/uascsearch/config/wsgi.py
<Directory /var/www/uascsearch/config>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static/ /var/www/uascsearch/static/
<Directory /var/www/uascsearch/static>
Require all granted
</Directory>
Alias /media/ /var/www/uascsearch/media/
<Directory /var/www/uascsearch/media>
Require all granted
</Directory>
Header always set X-Content-Type-Options nosniff
Header always set X-Frame-Options SAMEORIGIN
Header always set X-XSS-Protection "1; mode=block"
ErrorLog ${APACHE_LOG_DIR}/uascsearch_error.log
CustomLog ${APACHE_LOG_DIR}/uascsearch_access.log combined
</VirtualHost>Enable and start Apache:
sudo systemctl start httpd
sudo systemctl enable httpd
sudo httpd -t # Test configurationIf SELinux is enabled:
# Check SELinux status
getenforce
# Set required booleans
sudo setsebool -P httpd_can_network_connect 1
sudo setsebool -P httpd_can_network_connect_db 1
# Set file contexts
sudo semanage fcontext -a -t httpd_config_t "/var/www/uascsearch(/.*)?"
sudo semanage fcontext -a -t httpd_exec_t "/var/www/uascsearch/venv/bin/python*"
sudo restorecon -Rv /var/www/uascsearchsudo systemctl start firewalld
sudo systemctl enable firewalld
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reloadsudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
sudo iptables-save | sudo tee /etc/iptables/rules.v4Install Certbot:
sudo dnf install -y certbot python3-certbot-apacheObtain certificate:
sudo certbot --apache -d your-domain.com -d www.your-domain.comTest auto-renewal:
sudo certbot renew --dry-runsudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/ssl/private/uascsearch.key \
-out /etc/ssl/certs/uascsearch.crt \
-subj "/C=US/ST=RI/L=Kingston/O=URI/CN=your-domain.com"
sudo chmod 600 /etc/ssl/private/uascsearch.keyAdd SSL VirtualHost to Apache configuration:
<VirtualHost *:443>
ServerName your-domain.com
DocumentRoot /var/www/uascsearch
SSLEngine on
SSLCertificateFile /etc/ssl/certs/uascsearch.crt
SSLCertificateKeyFile /etc/ssl/private/uascsearch.key
# Same WSGI and directory configuration as HTTP version
# ... (copy from above)
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
</VirtualHost>cd /var/www/uascsearch
# Test with a few files first
sudo -u apache venv/bin/python manage.py index_xml --max-files 5 --delay 2.0 --clear
# Index all files (this may take 30+ minutes)
sudo -u apache venv/bin/python manage.py index_xml --clear --delay 1.0curl "http://your-domain.com/search/?q=test"
curl "https://your-domain.com/search/?q=history"Visit: https://your-domain.com/admin/
Visit: https://your-domain.com/standalone-search/
- Upload
wordpress-integration/uri-xml-search.phpto/wp-content/plugins/uri-xml-search/ - Upload supporting files (
uri-xml-search.js,uri-xml-search.css) - Activate plugin in WordPress admin
- Configure API URL in plugin settings
- Add shortcode:
[uri_xml_search]
- Upload
wordpress-integration/uri-xml-search-nojs.phpto/wp-content/plugins/uri-xml-search-nojs/ - Upload
uri-xml-search-nojs.css - Activate and configure as above
- Add iframe to WordPress page:
<iframe src="https://your-domain.com/standalone-search/" width="100%" height="600" style="border:1px solid #ccc;"></iframe>sudo systemctl status httpdsudo tail -f /var/log/httpd/uascsearch_error.logcd /var/www/uascsearch
sudo -u apache venv/bin/python manage.py checkls -la /var/www/uascsearch/
# Should show apache:apache ownershiphttpd -M | grep wsgiEdit /etc/httpd/conf.modules.d/00-mpm.conf:
<IfModule mpm_prefork_module>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxRequestWorkers 256
MaxConnectionsPerChild 0
</IfModule>For high traffic, adjust WSGI processes:
WSGIDaemonProcess uascsearch processes=4 threads=15 python-path=/var/www/uascsearch python-home=/var/www/uascsearch/venvConsider PostgreSQL for production:
# Install PostgreSQL
sudo dnf install postgresql postgresql-server python3-psycopg2
# Create database and user
sudo -u postgres createdb uascsearch
sudo -u postgres createuser --interactive uascsearch_user
# Update Django settings.py to use PostgreSQL# Update system packages
sudo dnf update
# Update Python packages
cd /var/www/uascsearch
sudo venv/bin/pip install --upgrade -r requirements.txt
# Restart Apache
sudo systemctl restart httpd# Weekly or monthly re-indexing
sudo -u apache venv/bin/python manage.py index_xml --clear --delay 1.0cd /var/www/uascsearch
sudo -u apache venv/bin/python manage.py dumpdata > backup_$(date +%Y%m%d).jsonThis manual setup provides complete control over the installation process and allows for customization based on your specific server environment and requirements.