RanniSch / webserv

0 stars 2 forks source link

Configuration: Setup multiple servers with different hostnames (use something like: curl --resolve example.com:80:127.0.0.1 http://example.com/ (http://example.com/)) #72

Closed MaxIhme closed 10 months ago

MaxIhme commented 10 months ago

config: server { host example.com; ... } server { host another_example.com; ... }

server says: Host: example.com ...succesfully created!... Host: another_example.com ...succesfully created!...

our server is not doing anything more. It's only looking to the right ports -> the hostnames are irrelevant.

MaxIhme commented 10 months ago

but you can change the hosts file:

sudo vim /etc/hosts/ and put in: 127.0.0.1 example.com save and exit. http://example.com:8080 will now be redirected to us but http://example.com/ not!

RanniSch commented 10 months ago

@MaxIhme you started "./webserv web.conf" ?

I cannot use this config file: image

all config files are in conf/.conf -> when you put another config file to test there you have to do: ./webserv conf/.conf

RanniSch commented 10 months ago

How do you test this???

Edit Max: look at the first post. put host example.com; in the server directive and start webserve with that config. in bash should come: Finished creating the ports: ........ example.com ......

and then you can do the second post.. modify the hosts file on your system and put "127.0.0.1 example.com" in and save it.

Then you start webserve and put in the browser http://example.com:8000 and our website should come

MaxIhme commented 10 months ago

for me (as describes in the top comments) runs ok

RanniSch commented 10 months ago

curl --resolve example.com:8000:127.0.0.1 http://example.com:8000