Skip to main content
Glama

generate_nginx_vhost

Create nginx virtual host configuration files for Webasyst projects by specifying domain, root path, and PHP version to deploy applications.

Instructions

Сгенерировать nginx-конфиг

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYes
root_pathYes
php_versionNo

Implementation Reference

  • The handler function that implements the generate_nginx_vhost tool. It generates an Nginx vhost configuration file with a server block listening on port 80, configured for PHP-FPM, and saves it as {domain}.nginx.conf in the current directory.
    async function generateNginxVhostTool({ domain, root_path, php_version = '8.2' }) { const vhost = `server { listen 80; server_name ${domain}; root ${root_path}; index index.php; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \\.php$ { fastcgi_pass unix:/var/run/php/php${php_version}-fpm.sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } `; const file = path.join(process.cwd(), `${domain}.nginx.conf`); await fs.writeFile(file, vhost); return { content: [{ type: 'text', text: `Nginx vhost создан: ${file}` }] }; }
  • Registration of the 'generate_nginx_vhost' tool in the MCP server's tools list, including its description and input schema definition.
    { name: 'generate_nginx_vhost', description: 'Сгенерировать nginx-конфиг', inputSchema: { type: 'object', properties: { domain: { type: 'string' }, root_path: { type: 'string' }, php_version: { type: 'string' } }, required: ['domain', 'root_path'] } }, { name: 'generate_htaccess', description: 'Сгенерировать .htaccess', inputSchema: { type: 'object', properties: { root_path: { type: 'string' } }, required: ['root_path'] } },
  • The switch case in the CallToolRequestSchema handler that routes calls to the generateNginxVhostTool function.
    case 'generate_nginx_vhost': return await generateNginxVhostTool(args);
  • Input schema for the generate_nginx_vhost tool, defining required parameters: domain and root_path, optional php_version.
    { name: 'generate_nginx_vhost', description: 'Сгенерировать nginx-конфиг', inputSchema: { type: 'object', properties: { domain: { type: 'string' }, root_path: { type: 'string' }, php_version: { type: 'string' } }, required: ['domain', 'root_path'] } }, { name: 'generate_htaccess', description: 'Сгенерировать .htaccess', inputSchema: { type: 'object', properties: { root_path: { type: 'string' } }, required: ['root_path'] } },

Latest Blog Posts

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/emmy-design/webasyst-mcp'

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