How to use MBL as a web server?

Since the MBL runs on Linx and has apache installed, to run the default UI, I would like to know if it can be used to as a web server to host my websites.

I have web prototypes (static content, html & images only) and would want to put it on my MBL so that I can open them up from any of my devices on the network (internal).  Would it be possible to use the existing apache installation without messing up the MBL UI.  Can we configure a new port like 8080 and have all my prototypes under it.

I’m not a Linux guy, appreciate if somone can help me with links or the commands to get this in place.

There are several things you can do. Here is a couple of ideas.  I assume you can ssh to the MBL.

The easiest is to add your html code to “/var/www”  The UI is mostly in “/var/www/UI” so you will not mess it up.   You cannot have an index.hml page if you want the UI to be the default so something like mypage.html.

A little more trouble would be to use apache’s sites-available for Virtual Hosts - you can google for more examples. This is a example of having your html on the Public MBL share in WWW/My-WWW.  I use the Public share to make it easier to edit the html from my Windows machine.  Note you need to have more for security if you expose this website outside your firewall.

  1. Create WWW/My-WWW  on the Public share (It IS case-sensitive) and put your html there with an index.html.  This will be set as the DocumentRoot below.

2. In Putty: ssh root@YourMBL

  1. Type: nano /etc/apache2/sites-available/My-WWW  (This will create a file named My-WWW)

  2. Enter:

    NameVirtualHost *:8080
    Listen 0.0.0.0:8080

    <VirtualHost *:8080>
    ServerAdmin webmaster@localhost

     # Index file and Document Root (where the public files are located)
     DirectoryIndex index.html
     DocumentRoot /shares/Public/WWW/My-WWW
    
     ErrorLog /var/log/apache2/My-WWW-error.log
    
     # Possible values include: debug, info, notice, warn, error, crit,
     # alert, emerg.
     LogLevel warn
    

Ctrl-O to save, Ctrl-x to exit

  1. Type:  a2ensite My-WWW  and follow instructions to reload apache

http://YourMBL:8080 should bring up the web page

  1. Type:  a2dissite My-WWW to turn it off
3 Likes

RickGTX, that was exactly what I wanted.

I did everything from 1 to 5, (6 was not needed, I did not want to stop the website) and it worked like a charm.

Thanks a lot.

1 Like

Hi,

Can I setup things to host a ‘public’ website as well please? I want to do the same thing you have described - with the addition of making this web-site (only), visible / accessible from the internet.

Cheers!

@happyBoy, I assume you are aware that you need a Public IP to host your website, and you can forward requests from port 80 to your MBL via your router.

Hi,

Thanks.

Yes I think I can manage a static IP from my ISP and then do Dynamic DNS of some sort.

So all I need to then is port forward port 80 to the relevant apache port on the MBL?

Yes that should work.  Also review some of the sites-available files in /etc/apache2/sites-available to add more security.

I would at least add after the DocumentRoot just to prevent access to the file system:

<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>

 There are other directives to prevent certain programs from being executed.

Many Thanks - will give this a shot sometime next week and report back!

Hi, RickGTX thanks for your answer, it works correctly :slight_smile:

I shared one of my public folders “/shares/Public/Shared Videos/Movies”, but when I browse my new server url: http://myMBL:8080/ I can’t view the movie folder list that I have in this directory, and I get an “Not Found - The requested URL / was not found on this server.”

I created an index.html to verify that the web server was working properly, and it appears without problems.

I found this post: http://www.opensourceisbetter.com/disable-directory-listingbrowsing-apache/ but it’s not working me.

You can say me what I need to enable to get the folder list view in my webserver.

Thanks in advance!

Options Indexes should do the trick.  Is your DocumentRoot /shares/Public/Shared Videos/Movies ?

Can you see http://myMBL:8080/_MyMovie.mp4_ ?

If you used the example DocumentRoot in the second post, create a symbolic link to your /Shared Videos/Movies from WWW/My-WWW

cd /shares/Public/WWW/My-WWW

ls -s  /shares/Public/Shared Videos/Movies Movies

Then http://myMBL:8080/Movies will give a list

This is what I would do to keep all my Public shares from the Web just show the Movies.