C and HTML cannot be connected just by creating a localhost web server. To establish a "connection" between them, you need a C API to interact with the server and your C program. FastCGI Protocol Simple and easy to use for beginners, but may not be the best choice for more professional projects. Check out information about FastCGI, an API for C. Here's a useful GitHub link I recommend getting started: https://github.com/eddic/fastcgipp.