Skip to main content
Glama
install-nginx.sh4.41 kB
#!/bin/bash ################################################################################ # Install and Configure Nginx for KYC MCP Server # This script installs Nginx and sets up the reverse proxy configuration ################################################################################ set -euo pipefail # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Logging functions log_info() { echo -e "${GREEN}[INFO]${NC} $1" } log_warn() { echo -e "${YELLOW}[WARN]${NC} $1" } log_error() { echo -e "${RED}[ERROR]${NC} $1" } # Check if running as root if [ "$EUID" -ne 0 ]; then log_error "Please run as root or with sudo" exit 1 fi # Detect OS if [ -f /etc/os-release ]; then . /etc/os-release OS=$ID else log_error "Cannot detect OS" exit 1 fi log_info "Installing Nginx for KYC MCP Server..." # Install Nginx log_info "Installing Nginx..." if [ "$OS" = "amzn" ]; then amazon-linux-extras install nginx1 -y yum install -y nginx elif [ "$OS" = "ubuntu" ]; then apt-get update apt-get install -y nginx fi # Install nginx-extras for more_clear_headers if [ "$OS" = "ubuntu" ]; then apt-get install -y nginx-extras fi # Create directories log_info "Creating directories..." mkdir -p /etc/nginx/sites-available mkdir -p /etc/nginx/sites-enabled mkdir -p /var/www/certbot # Backup default configuration if [ -f /etc/nginx/nginx.conf ]; then log_info "Backing up default nginx.conf..." cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.backup fi # Copy configuration file SCRIPT_DIR="$(dirname "$0")" CONFIG_FILE="$SCRIPT_DIR/kyc-mcp.conf" if [ ! -f "$CONFIG_FILE" ]; then log_error "Configuration file not found: $CONFIG_FILE" exit 1 fi log_info "Installing Nginx configuration..." cp "$CONFIG_FILE" /etc/nginx/sites-available/kyc-mcp.conf # Prompt for domain name read -p "Enter your domain name (or press Enter to skip SSL setup): " DOMAIN_NAME if [ -n "$DOMAIN_NAME" ]; then log_info "Configuring for domain: $DOMAIN_NAME" sed -i "s/your-domain.com/$DOMAIN_NAME/g" /etc/nginx/sites-available/kyc-mcp.conf else log_warn "Skipping SSL configuration. You can configure it later." # Comment out SSL-related lines sed -i 's/listen 443/# listen 443/g' /etc/nginx/sites-available/kyc-mcp.conf sed -i 's/ssl_/# ssl_/g' /etc/nginx/sites-available/kyc-mcp.conf fi # Enable site log_info "Enabling site..." ln -sf /etc/nginx/sites-available/kyc-mcp.conf /etc/nginx/sites-enabled/ # Remove default site if exists if [ -f /etc/nginx/sites-enabled/default ]; then rm /etc/nginx/sites-enabled/default fi # Test configuration log_info "Testing Nginx configuration..." if nginx -t; then log_info "Nginx configuration is valid" else log_error "Nginx configuration test failed" exit 1 fi # Enable and start Nginx log_info "Enabling and starting Nginx..." systemctl enable nginx systemctl restart nginx # Configure firewall log_info "Configuring firewall..." if command -v ufw &> /dev/null; then ufw allow 'Nginx Full' ufw reload elif command -v firewall-cmd &> /dev/null; then firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https firewall-cmd --reload fi log_info "==========================================" log_info "Nginx installation completed successfully!" log_info "==========================================" echo "" if [ -n "$DOMAIN_NAME" ]; then log_info "Next steps for SSL setup:" echo "1. Ensure your domain DNS points to this server" echo "2. Install Certbot: sudo apt-get install certbot python3-certbot-nginx" echo "3. Obtain SSL certificate: sudo certbot --nginx -d $DOMAIN_NAME" echo "4. Test auto-renewal: sudo certbot renew --dry-run" else log_info "To configure SSL later:" echo "1. Edit /etc/nginx/sites-available/kyc-mcp.conf" echo "2. Replace 'your-domain.com' with your actual domain" echo "3. Uncomment SSL-related lines" echo "4. Run: sudo certbot --nginx -d your-domain.com" fi echo "" log_info "Nginx management commands:" echo " sudo systemctl status nginx" echo " sudo systemctl restart nginx" echo " sudo systemctl reload nginx" echo " sudo nginx -t # Test configuration" echo "" log_info "View logs:" echo " sudo tail -f /var/log/nginx/kyc-mcp-access.log" echo " sudo tail -f /var/log/nginx/kyc-mcp-error.log"

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CTD-Techs/CTD-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server