# Building a small home based web site



## PacketMan (Aug 25, 2017)

So, in a short few months, this routing & switching guy will put his fishing rods away, and want to try a new project.  I have no clue how to build a web site (i.e server and content) for my family use; meaning it would not be public based, but could be accessible from the Internet.

So, for those of you that have done this at home, or web sites is your bread n' butter, what FreeBSD ports do you suggest I install? I'm looking at www/nginx but I'm guessing this is just one of a few.  I'd like to have authentication obviously, and ideally the web site would recognize various browsers including cell phone browsers.

No flash, but certainly HTML5 I'm guessing.  Not looking for a "how to build a web site" points, that is my project to figure out (will try to get my kids involved too), but what would be a few ports needed to get my feet wet, get a web site up and running fairly easy, and of course learn a bunch of stuff along the way.  I'll likely use the family Ubuntu machine to build the web pages, but a FreeBSD desktop will certainly be involved too sooner or later.  Ideally the web site itself would provide the functionality of allowing itself to be modified (i.e adding and deleting content) versus me using an external tool and then uploading the changes.

Thanks again everyone.


----------



## SirDice (Aug 25, 2017)

For a basic (static) web site you don't need much more than www/nginx or www/apache24 (the two most common webservers). A more dynamic web site usually involves said webserver plus www/mod_php56 and databases/mysql57-server. That will give you a FAMP (FreeBSD, Apache, MySQL, PHP) setup. You'll find lots of references on the internet about a LAMP (Linux, Apache, MySQL, PHP) which is the same thing but on Linux.


----------



## ekingston (Aug 25, 2017)

PacketMan, you have asked a very VERY broad question. Just as "_there is more than one way to skin a cat_", there is way more than one way to make a website.

First off, you need a server. You have indicated you use Ubuntu. That can work fine. So does FreeBSD (or even Windows). Your server will need to be always on (otherwise other poeple won't be able to access it).

So, step 1: Hardware. What should you use?

You could run it on your existing Ubuntu machine, in which case you might want to go to the Ubuntu forums and ask there. You could run it on some other desktop you already have. You could re-purpose an existing (or old) desktop as a dedicated server. You could buy new hardware.

Whatever you decide, based on what you are asking, I would suggest you start by running it on one of your existing desktops or a very inexpensive dedicated system. If you decide to buy "new" go cheap. A low-end Intel NUC (Zotac ZBox, or other small form factor) is more than enough for a home web server.

Step 2: Operating System.

Pick your operating system. I suggest going with one you know well. As this is the FreeBSD forum, I will assume you pick FreeBSD (but Ubuntu or Windows would work equally well).

Step 3: Web Server Software.

You mentioned nginx, that works. Other popular choices include Apache HTTPd and Lighttpd. All are available in ports.

Step 4: Content Management

You mentioned you would like the website to be updated directly as opposed to editing files and uploading them. This means some sort of content management system. there are many. Joomla is in the FreeBSD ports (wordpress is another popular choice).

Whichever one you choose will have a bunch of dependencies. In FreeBSD these will be installed automatically. 

But you also said you wanted to learn HTML5 and such. Generally content management systems insulate you from the underlying structure so you don't have to learn things like HTML5, CSS, and Javascript.


----------



## PacketMan (Aug 25, 2017)

Thanks again SirDice.....FAMP/LAMP ...understood; I'll start reading soon.

..and thanks for your comments too ekingston.  I already have a FreeBSD server in my house; doing a few cool things. Just so you know all my machines are FreeBSD based, except one Ubuntu laptop for the wife. I only mentioned this laptop since its in a commonly located spot. And thanks for the points about in Step 4.  I have lots to learn, and don't fear mistakes.


----------



## ekingston (Aug 25, 2017)

PacketMan said:


> Thanks again SirDice.....FAMP/LAMP ...understood; I'll start reading soon.
> 
> ..and thanks for your comments too ekingston.  I already have a FreeBSD server in my house; doing a few cool things. Just so you know all my machines are FreeBSD based, except one Ubuntu laptop for the wife. I only mentioned this laptop since its in a commonly located spot. And thanks for the points about in Step 4.  I have lots to learn, and don't fear mistakes.



If you want to learn "_real web development_", I suggest you don't use a content management system but built what you want yourself. SirDice's suggestion of FAMP/LAMP is the base for build it yourself (and is also the underlying tools that most content management systems are built on).

My personal (and weird by most standards) home web server set-up is Apache with HTTP-Basic Auth and WebDav enabled. The website content is a tool called "tiddlywiki". This won't help you learn much in the way of web development but it is considerably lighter weight than a full FAMP/LAMP stack.


----------



## ronaldlees (Aug 26, 2017)

This is one of those topics that usually shows how people learn a system, and seem to stick with it, due to the learning curve.  Natch - I do that myself.   So, the Drupal guys stay with that (and evangelize for it), the Django guys evangelize - and the same goes for webservers like apache and nginx, etc.  I started using Django when it was first created and used early on as a CMS for the Washington Post.  It was definitely not a "quick site" build.

Recently, I wanted to do about the same thing as you.  So, I picked Wordpress.  Yes - it's built for rank beginners.  But, even a seasoned web guy will start from scatch faster on it (since there's basically nothing to do).   Most of my online stuff is already there, and I've gotten into a close-my-eyes-to-do-it easy routine.  So, I'm like the other fanboys I guess.  It's the most popular CMS on the planet, so the most targeted.  So, if it's accessible to the general internet, then as a suggestion ... maybe not so much.

My last Wordpress project runs FreeBSD11.0 on a Pi2, with Hiawatha-webserver as the server, SQLite3 as the db, php-fpm for the php access, and  of course the Wordpress app.  The Pi2 also serves as the WiFi access point.

So, I guess that's FHSP (fishup?).  But, my system is not accessible to outside world (unless they crack the WiFi).  Anyway, have been using Hiawatha recently, and so far like it.  It's the "non-cola" webserver ...


----------



## Deleted member 30996 (Aug 27, 2017)

PacketMan said:


> No flash, but certainly HTML5 I'm guessing.  Not looking for a "how to build a web site" points, that is my project to figure out (will try to get my kids involved too)...



When you're ready W3Schools is the place to learn it.

I taught myself how to write valid XHTML and CSS by hand on a text editor and is how I build mine. You can learn HTML5, SQL, PHP, ASP, JavaScript, etc. 

It's fun and easy so the kids should like it, too.


----------



## Deleted member 9563 (Aug 27, 2017)

I use editors/ne and have many websites done with that. Even larger ones. The fact is that any editor will do the trick. Install www/apache22 (`pkg install apache22`) and put this file in your /var/www directory:

```
<html>
  <head>
    <title>My Web Site</title>
  </head>
  <body>
<p>
Your stuff here. 
</p>
  </body>
</html>
```
The rest you learn as you go along. Remember that you can always look at what others are doing by using `Ctrl-U` in most browsers.


----------



## obsigna (Aug 27, 2017)

I would choose PostgreSQL over MySQL, because the documentation is much better structured and it is not that a big memory hog.

On FreeBSD, I suggest to always start with the latest releases in the ports, e.g. Apache 2.4 instead of Apache 2.2, PostgreSQL 9.6 instead of PostgreSQL 9.{3|4|5}, PHP 7.1 instead of 7.0 or 5.x, etc.

You want to install a test server on your development machine, reflecting more or less the same setup as it is present on your home server. In this scenario, you would edit the web pages locally, and for testing you would point your browser to http://localhost/some_path/. Once everything is working to your liking, you transfer the changes to the sites store on your home server.

You want to think about installing a SVN repository for your web sites on your home server. The great thing with this is, that you could do a `svn commit` on your development machine, and then within the site directory on your home server, a single command `svn update` would be sufficient to bring your web site to that latest state -- this could even be automated, although, I like more to run `svn update` manually -- once I am really sure. Also, if something fails, SVN allows you to switch back easily to a previous working state, and so you are able to iron out the issues with a calm hand on your development machine while your web site continues to be online. Finally, a version control system like SVN is quite useful for a team (dad + kids) of developers working on the same project.

You need to take care that meta data of your web project may not be accessed via the web server. I use Apache, and
since my development machine is a Mac and I use Xcode for my Web projects, I placed into /usr/local/etc/apache24/httpd.conf the following directive:

```
...
# Prevent .svn and .xcodeproj directories from being disclosed
<DirectoryMatch "\.(svn|xcodeproj)">
   Require all denied
</DirectoryMatch>
```
For sure similar directives exist for Nginx. If your project becomes bigger, you might want to take advantage of some sort of an IDE, and it is helpful to store the meta data of the IDE into the SVN repository as well. In this case you would need to add an exclusion directive for the IDE meta data to the settings of your web server, as I did with .xcodeproj.


----------



## Deleted member 9563 (Aug 27, 2017)

ronaldlees said:


> This is one of those topics that usually shows how people learn a system


You got that right. Now I'm seeing database programming, version control, PHP, Java, and god knows what. Frankly, for someone who is starting out, to get such a grip before seeing any results is unrealistic. The guy is asking, as a beginner, for a "small home based web site", for goodness sake.


----------



## obsigna (Aug 27, 2017)

OJ said:


> You got that right. Now I'm seeing database programming, version control, PHP, Java, and god knows what. Frankly, for someone who is starting out, to get such a grip before seeing any results is unrealistic. The guy is asking, as a beginner, for a "small home based web site", for goodness sake.


Honestly, somebody with 532 posts and 40 thanks cannot  exactly be called a beginner. You also want to read the initial message once again for figuring out the objectives -- authentication, responsive design, Ubuntu development machine, server on FreeBSD, facility to transfer modifications, working in a dev team (dad + kids) ...

Now tell me, where you got the courage, for coming-up with a primary school web page building example, which does not give any ideas of a direction how a web project might evolve.


----------



## Deleted member 9563 (Aug 28, 2017)

obsigna said:


> Now tell me, where you got the courage, for coming-up with a primary school web page building example, which does not give any ideas of a direction how a web project might evolve.


Well what I said seems to fit the bill exactly. Suitable for someone who knows a few things but wants a web site quickly for the first time. This is where to start to "get a web site up and running fairly easily" without using an "external tool".



PacketMan said:


> Not looking for a "how to build a web site" points, that is my project to figure out (will try to get my kids involved too), but what would be a few ports needed to get my feet wet, get a web site up and running fairly easy, and of course learn a bunch of stuff along the way. . . . Ideally the web site itself would provide the functionality of allowing itself to be modified (i.e adding and deleting content) versus me using an external tool and then uploading the changes.



Those were the questions. Perhaps you read it differently.


----------

