Virtual hosts don't work. I don't know what to do

Hey I tried to set-up virtual hosts my first time.
DOMAIN REDIRECT TO LOCALHOST WEBSITE. ( I want to redirect it to var/www/ not to var/www
I read a lot of tutorials, but i still can’t do this. Now I think i can’t setup because virtual host have problem with SSL.
I have debian 7.
I have enabled site by command a2ensite and I didnt get any errors.
Please, help thanks!
That’s my virtual host for domain which redirect to directory var/www/

Oh I have copy and paste it from default directory, but there wasnt ServerName and Server alias so i added this.

I believe your issue doesn’t belong here. It should be posted in an Apache server forum (or Stack Overflow?).

I said, In my opinion I did everything well, and i’m able to think that’s cause Cloudflare SSL, and I hope there will be a guy who can help me if im wrong and that’s not cause Cloudflare :confused:

Well, but the website for me works and it’s HTTPS…

You are asking redirects to local folders, in the config file for Apache.

1 Like

Once you get your virtual host settings in Apache fixed, you’ll be able to use SSL from Cloudflare.

Guys, I have SSL already. Yes I was asking redirect to local folders, but if there is a other way to do it you can help me Matteo.

Ok, so you want a redirect. You can also use Page Rules to redirect to a folder in your domain.

Eem no.
I want to setup 2 sites on one ip.

That’s an Apache configuration issue, not a Cloudflare issue. Please refer to @matteo’s Stack Overflow suggestion above.

Once you get those two domains (or sites) working on one IP address, you’ll be able to add them to Cloudflare.


I posted on Stack Overflow. Matteo, if u have some time, can you look and help me with solution? Thanks.

I really don’t know my way around Apache config so well, basic config it’s fine, but nothing too advanced in that department. Hope you find a solution though!

May I suggest you try creating two VirtualHost blocks, though? May work, nginx works that way…

This is as old as Apache itself:

1 Like

Good to know, my idea was correct even though I never used it :joy:

You are using IIS? :joy:

Usually nginx, Node.js/Express or preferably something that need no configuration for those things (Firebase, their CDN is faster than CF’s even if in cache given same POP location, it’s Google, but still).

Thanks god. For a minute i thought you’re a Windows guy :speak_no_evil: :smiling_imp:


Never! I have it in a VM just in case I need to help somebody using it or for specific use cases where UNIX/macOS doesn’t work. We’re getting off-topic… Would love PMs for TL4, @Ryan.

EDIT: actually never even used or installed IIS once.

1 Like

I did that and still redirecting to main site(
I tried to put it into default file, and next i created new file and there I put this.
And I don’t understand whats mean NameVirtualHost *:80
Help please :confused:

This is error in putty, when I put NameVirtualHost *:80
what thats meaning?