Score:0

Apache 2.4 Reverse Proxy using HTTPd

ls flag

I created an AWS EC2 instance with a public IP, lets call it 100.0.0.0.

I added a rule for the security group to allow incoming HTTP traffic on port 80 for any IPv4.

I added to the config file in: /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass /test/ http://www.example.com/
    ProxyPassReverse /test/ http://www.example.com/
</VirtualHost>

Which when I went to http://100.0.0.0/test/ , I got a 404 - Not Found displayed on my browser. Nothing in error_log.

I also tried this with a local host

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass /test/ http://localhost:8080/
    ProxyPassReverse /test/ http://localhost:8080/
</VirtualHost>

&

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass /test/ http://127.0.0.1:8080/
    ProxyPassReverse /test/ http://127.0.0.1:8080/
</VirtualHost>

Which gave me in the logs:

Connection refused: AH00957: http: attempt to connect to 127.0.0.1:8080 (127.0.0.1) failed

AH01114: HTTP: failed to make connection to backend: 127.0.0.1, referer: http://100.0.0.0/

Since this is created with AWS I also tried creating an outbound rule, where I allowed any for IPv4. Im not sure if I need to set any more rules in AWS, or if I missed a step configuring my proxy.

See doc I followed: https://linuxtechlab.com/apache-as-reverse-proxy-centos-rhel/

I also referenced: https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html which lead me to the www.example.com example.

netstat -aon | grep 8080
TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       22304
TCP    [::]:8080              [::]:0                 LISTENING       22304
TCP    [::1]:8080             [::]:0                 LISTENING       25212
in flag
`Connection refused` indicates that nothing is listening on `127.0.0.1:8080`. Check if your service is actually running and if it is bound to the correct interface.
Travis avatar
ls flag
@GeraldSchneider Would that be seeing a state of 'Established' using netstat in console?
in flag
Depends on the context. Why don't you show the complete output?
Travis avatar
ls flag
@GeraldSchneider see update on question
in flag
That doesn't say anything. Do you have a line that says state `LISTEN` for port 8080?
Travis avatar
ls flag
Check updates, I believe this is what we are looking for
Travis avatar
ls flag
Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/141120/discussion-between-travis-and-gerald-schneider).
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.