# nginx sites-available and sites-enable



## Ependi Silalahi (Sep 10, 2016)

I can't find sites-available and sites-enable on my nginx
whereis conf.d 
in linux i can see them in /etc/nginx
Thanks


----------



## Vincent See (Sep 10, 2016)

I'm sorry, but I think you have to create them yourself, there is a great guide posted by one of the members here in the forum https://forums.freebsd.org/threads/42312/ .


----------



## Ependi Silalahi (Sep 10, 2016)

Vincent See said:


> I'm sorry, but I think you have to create them yourself, there is a great guide posted by one of the members here in the forum https://forums.freebsd.org/threads/42312/ .


I have lots of reading to do and thanks
It is going to be very slow to comprehend but it is just me slow learner


----------



## Vincent See (Sep 10, 2016)

Ependi Silalahi said:


> I have lots of reading to do and thanks
> It is going to be very slow to comprehend but it is just me slow learner


I'm the same as you new to FreeBSD but its fun to learn these things  This helped me alot maybe this has some use to you https://www.digitalocean.com/commun...wordpress-with-nginx-on-a-freebsd-10-1-server and http://www.cyberciti.biz/faq/freebsd-nginx-namebased-virtual-hosting-configuration/ .


----------



## drhowarddrfine (Sep 10, 2016)

Fun fact. nginx was developed solely on FreeBSD for over 10 years, and is still strongly supported, but only last year was forced to do their main development on Linux due to market pressures and all the problems with Linux (systemd and other issues I don't recall).


----------



## Ependi Silalahi (Sep 10, 2016)

Vincent See said:


> I'm the same as you new to FreeBSD but its fun to learn these things  This helped me alot maybe this has some use to you https://www.digitalocean.com/commun...wordpress-with-nginx-on-a-freebsd-10-1-server and http://www.cyberciti.biz/faq/freebsd-nginx-namebased-virtual-hosting-configuration/ .


Thanks Vincent. Sorry for late responds. I was up till 5 am last night trying to figure out and read lots of tutorials including yours. Somehow I was able to display my first basic page but not they way i wanted it.
Here is what i am trying to do. I have done this in linux but i want to learn how to do it on freebsd and i like freebsd because it challenges me.
On freebsd machine (home's  network)I would like to have nextcloud and joomla but they way I want is like this https://nextcloud and https://joomla . i dont want like this https://joomla/nextcloud is that possible or am I stuck with this https://joomla/nextcloud since i dont have fqdn.
i use ddns to access my owncloud from outside and i use openvpn too. I did it with linux now i want to switch to freebsd. I am like you it is fun to learn freebsd and i like freebsd too.


----------



## Vincent See (Sep 11, 2016)

Ependi Silalahi said:


> Thanks Vincent. Sorry for late responds. I was up till 5 am last night trying to figure out and read lots of tutorials including yours. Somehow I was able to display my first basic page but not they way i wanted it.
> Here is what i am trying to do. I have done this in linux but i want to learn how to do it on freebsd and i like freebsd because it challenges me.
> On freebsd machine (home's  network)I would like to have nextcloud and joomla but they way I want is like this https://nextcloud and https://joomla . i dont want like this https://joomla/nextcloud is that possible or am I stuck with this https://joomla/nextcloud since i dont have fqdn.
> i use ddns to access my owncloud from outside and i use openvpn too. I did it with linux now i want to switch to freebsd. I am like you it is fun to learn freebsd and i like freebsd too.


Hi Ependi Silalahi, I just finished fixing my bacula, honestly I want to do something the same as yours as you describe, I will test nginx now and update you what I find.  I just read somewhere (I couldn't remember where) but I think you need an additional virtual IP setup. Example, if you have one computer that has an IP address of 192.168.1.140 and it has https://nextcloud on it, you cannot have another website on that same IP. So what you do is create another virtual IP from the same computer that outputs 192.168.1.141 and have https://joomla on it. I will search that up.


----------



## Vincent See (Sep 11, 2016)

Ependi Silalahi said:


> Thanks Vincent. Sorry for late responds. I was up till 5 am last night trying to figure out and read lots of tutorials including yours. Somehow I was able to display my first basic page but not they way i wanted it.
> Here is what i am trying to do. I have done this in linux but i want to learn how to do it on freebsd and i like freebsd because it challenges me.
> On freebsd machine (home's  network)I would like to have nextcloud and joomla but they way I want is like this https://nextcloud and https://joomla . i dont want like this https://joomla/nextcloud is that possible or am I stuck with this https://joomla/nextcloud since i dont have fqdn.
> i use ddns to access my owncloud from outside and i use openvpn too. I did it with linux now i want to switch to freebsd. I am like you it is fun to learn freebsd and i like freebsd too.


I think this explains why sites available and sites enable are not available in FreeBSD nginx. https://forums.freebsd.org/threads/42444/


----------



## Ependi Silalahi (Sep 11, 2016)

Vincent See said:


> Hi Ependi Silalahi, I just finished fixing my bacula, honestly I want to do something the same as yours as you describe, I will test nginx now and update you what I find.  I just read somewhere (I couldn't remember where) but I think you need an additional virtual IP setup. Example, if you have one computer that has an IP address of 192.168.1.140 and it has https://nextcloud on it, you cannot have another website on that same IP. So what you do is create another virtual IP from the same computer that outputs 192.168.1.141 and have https://joomla on it. I will search that up.


Vincent I was able to make something different and still using from the same machine 
My freebsd webserver is  192.168.10.30
I can go to chicago.com and miami.com both display different page because I have "include /var/www/vhosts/*.conf
also i have /var/www/chicago.com/index.html and /var/www/miami.com/index.html
then i use /etc/hosts like this
192.168.10.30  miami.com www.miami.com
192.168.10.30 chicago.com www.chicago.com
when type jakarta.com on my local pc it will go index.html of jakarta but if i type http://localhost or 192.168.10.30 it it will go to default nginx first page and I dont know how to turn off the nginx default first page. do you?


----------



## Vincent See (Sep 12, 2016)

I will try it out and update you on my findings, thank you for sharing it with me Ependi.


----------



## Vincent See (Sep 12, 2016)

I kept getting an error of http 500. I need to fix this first.


----------



## Ependi Silalahi (Sep 13, 2016)

Vincent See said:


> I kept getting an error of http 500. I need to fix this first.


vincent I dont know what to say I am still trying to reAd manual here and there


----------



## drhowarddrfine (Sep 14, 2016)

Go into /usr/local/etc/nginx/. There is where your directories all are except the default HTML files which are in /usr/local/www/nginx/.

In /usr/local/etc/nginx/nginx.conf, you will find


```
location / {
    root /usr/local/www/nginx;
    index index.html;
}
```

In there should be a configuration for root of your server and that should be pointing to /usr/local/www/nginx/ where the default index.html page is. You need to change the path to the root directory for your server where your index page is.


----------



## Ependi Silalahi (Sep 14, 2016)

drhowarddrfine said:


> Go into /usr/local/etc/nginx/. There is where your directories all are except the default HTML files which are in /usr/local/www/nginx/.
> 
> In /usr/local/etc/nginx/nginx.conf, you will find
> 
> ...


thanks for helping us out
When I compiled nginx there was no nginx.conf but I see nginx-con-dist  but in i see linux conf.d overwrite .conf what is in freebsd?


----------



## drhowarddrfine (Sep 14, 2016)

I've never heard of those exact filenames before. I don't know how nginx runs without nginx.conf. iirc, nginx.conf-dist is the default config file.  Just copy nginx.conf-dist to nginx.conf and edit that one.


----------



## Ependi Silalahi (Sep 14, 2016)

drhowarddrfine said:


> I've never heard of those exact filenames before. I don't know how nginx runs without nginx.conf. iirc, nginx.conf-dist is the default config file.  Just copy nginx.conf-dist to nginx.conf and edit that one.


Thats what I thought when I read the nginx.nginx-dist it look like nginx.conf only need to uncoment '#" 
Like in linux the conf.d overwrite *.conf what do they have similaties in freebsd or it doesnt exist?


----------



## drhowarddrfine (Sep 14, 2016)

As I said earlier, nginx was always developed on FreeBSD. Anything missing would be in the Linux version and the only reason they just now started developing on Linux cause Linux has different problems than the rest of the world. But it should work the same overall. For FreeBSD you do want `use kqueue` instead of the Linux thing (can't think of it). You also want `sendfile on`.

At the start everything else should work fine but, as you get more comfortable, there are things you can tune. Look at https://calomel.org/nginx.html for some ideas.


----------

