server { listen 80; server_name domain1.com www.domain1.com; root /var/www; ### # Using '/api' as the subdirectory. # If api is at root, change ALL '/api' to '/'. ### location /api { ### # By default, Nginx will serve xml; rewrite to index instead. ### location ~* \.(xml) { rewrite ^ /api/index.php?$uri&$args.xml last; } ### # Enable 'pretty urls'. ### try_files $uri $uri/ /api/index.php?$uri&$args; } ### # ... Rest of .conf ... ### }