In Cloud Foundry, how do I create a service to run my Apache web server?

141 views Asked by At

I'm on Ubuntu 18, running the following version of Cloud Foundry ...

$ cf -v
cf version 7.4.0+e55633fed.2021-11-15

I would to set up several containers, running off Docker image. First is an Apache web server. I have the following Dockerfile

FROM httpd:2.4
COPY ./my-httpd.conf /usr/local/apache2/conf/httpd.conf
COPY ./my-vhosts.conf /usr/local/apache2/conf/extra/httpd-vhosts.conf
COPY ./directory /usr/local/apache2/htdocs/directory

How do I set this up in Cloud foundry? I tried creating a service but got these errors

$ cf cups apache-service -p "localhost, 80"
FAILED
No API endpoint set. Use 'cf login' or 'cf api' to target an endpoint.

When I tried to create this API endpoint I got

$ cf api "http://my_ip_address"
Setting API endpoint to http://my_ip_address...
Request error: Get "http://my_ip_address": dial tcp my_ip_address:80: connect: connection refused
TIP: If you are behind a firewall and require an HTTP proxy, verify the https_proxy environment variable is correctly set. Else, check your network connection.

I'm thinking I'm missing something rather substantial but don't know what the right questions to ask are.

1

There are 1 answers

2
Noah On

The error message you are providing (dial tcp my_ip_address:80: connect: connection refused ) is related to the cf api $address not responding.

Ensure that your Cloud Foundry API Endpoint is still active and you don't have any firewall preventing you from accessing the API. (port is open, the process is running, and the firewall is allowing traffic from your IP if applicable)