LeMOGO's picture

First, let me specify that I am relatively new to Linu, and the only version i have toyed with is RHEL.

Second, the problem: I have been trying to use a single server to run multiple web packages to no avail.

I created new virtual interfaces in webmin, and I can reach the folder, but the server wants to send the index as a download, instead of running the scripts. I googled and found a couple of solutions i want to try, but I can't seem to understand how the server is configured.

Can someone please help me setup multiple servers on top of the LAMP stack in TKL?

Forum: 
Chris Musty's picture

Not quite sure of some of the above points you make but hopefully this will help a little.

On a LAMP server you place all your web files (HTML, PHP etc) under /var/www (if using joomla etc you would use /var/www/joomla and so forth for Drupal and Wordpress ...).

If you wanted to run multiple websites on an unvirtualised server you would need to make new folders in /var/www and reference the address in a browser accordingly.

For Example lets say you have a home network with a LAMP server at the address 192.168.0.110 and you have 5 websites in 5 folders you would need to reference them as follows

192.168.0.110/folder1/ 
192.168.0.110/folder2/
192.168.0.110/folder3/ 
192.168.0.110/folder4/ 
192.168.0.110/folder5/   Where "folderX" is the folder you have created

If you dont have an index.htm(l) or index.php file in there you should see a default directory structure.

Alternatively you could create a virtual environment so that each website is isolated from the others (if you mess up one the rest will not suffer).

You can do this with some modest hardware and a home network. We have even created a new youtube channel that will have some videos shortly but a video is available HERE to setup proxmox (a virtual environment like described above).

I would suggest you get familiar with the command line and there are some great tutorials out there.

Chris Musty

Director

Specialised Technologies

LeMOGO's picture

Thanks Musty.

 

I have:

  1. created virtual adapters and assigned them different IPs
  2. copied the webroot files under www
  3. pointed the virtual servers to the appropriate folder in apache configuration using webmin

When I use the browser with the above IP, it prompts me to download the file instead of running the php file.

Looking at the configuration files in the file browser, I found apache2.conf under apache2.

I can't find any reference of how php is loaded. I was looking for somethiing along the lines of "Include /etc/apache2/mod_php.conf", but there is no such line.  I am unable to find/understand how the php modules are loaded.
I do not see any "DirectoryIndex' line either.

I'm trying to understand what I need to configure in TK to run the php scripts.

Jeremy Davis's picture

using the Apache config files, rather than using Webmin. Reading the Apache2 page of the Ubuntu Server Guide would be a good starting point (TKL v11.x is based on Ubuntu Server 10.04).

Personally what I'd do is start back at the start. By default your LAMP server will work as Chris described above - if you put your separate websites in subfolders of /var/www eg /var/www/site1 then they will be accessable via http://<ip-address-or-fqdn>/site1 - php pages load properly by default (ie not download - something you have done has messed that up, hence why I suggest to start again).

Now if I understand you correctly, ultimately you wish to have these separate websites appear when your browse to their specific domain or sub-domain? AFAIK that is called name-based virtual hosting.

If so, then my suggestion would be to create each site as a separate virtual host. To do that copy the default site file to each new site you wish to have. To ease future confusion I'd name these sites the same as the folders (in /var/www), something like:

cp /etc/apache2/site-available/default /etc/apache2/sites-available/site1

and so on...

Using this default config as a base, configure each file to use the relevant folder as the doc root (ie change /var/www to /var/www/site1) and you will also need to change the asterisk at the top to the domain name you will be using (ie change '*' to 'site1.example.com').

Then enable your new sites and disable the default:

a2dissite default
a2ensite site1
a2ensite site2
a2ensite ...
service apache2 reload

Now if you try to browse to your server using IP address then you should get an error. This is because the server will now only respond when you are browsing for your specifc sites.

The final all important step is to point your domain name to your server IP. For testing puposes it is quite ok to just add an entry to your local hosts file (ie the hosts file on the computer with the web browser you are testing from - check google for specifics on how to do it on your specific OS). If you are on the same LAN as the server then you canpoint the name to the server LAN IP instead if you wish. But don't forget to remove the host entries when you have finished initial testing.

Once you have that working as expected and want to take your sites live (ie for external access), then you'll need to configure the DNS of your domain name registrar to point your domain names to your (external) IP. Assuming that your server is running on a LAN - you'll need to configure either a DMZ or NAT/port-forwarding and/or firewall to allow the incoming requests to forward to your server. 

As each domain registrar does DNS config differently I can't really guide you here, other than to say that with your domain registrar you'll need to create an A record for each domain name which points to your external IP (most have a self serve web form to do this). If you do not have a static (external) IP then I'd suggest you get one. Otherwise you could make do with a Dynamic DNS provider (you can use the TKL Hub, or there is a thread somewhere here with extensive suggestions on providers).

LeMOGO's picture

Thank you Jeremy,

I hae assigned a different IP to each site and was trying to access them directly with http://IP, and not http://IP/site1.

I got confused because I configured a few apache servers before, but it seems that things have changed in V2. On top of that, I am using TK which is preconfigured, so I had no clue where things were supposed to be placed.

From what you are saying, I understood that all virtual hosts configurations are placed in "sites-available" as files and apache2 automatically includes them. I found the following line in the config file:

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

 

I applied the suggestions above (except stating from scratch) to run some tests and see if I can find the configuration files. I ended up finding them in webmin under apache>global config>edit config files. I looked around a bit, then reread your post and got confused by this:

"Now if you try to browse to your server using IP address then you should get an error. This is because the server will now only respond when you are browsing for your specifc sites."

Why couldn't I reach the site by IP?

Also, shouldn't there be php module loaded on startup by apache2? I do not see any php reference in /etc/apache/mods-available

 

Thank you for the link. I'm reading...

Jeremy Davis's picture

Firstly, yes there are differences between v1 and v2, but there are also a number of differences in the way that Apache2 is setup in Debian/Ubuntu (as opposed to Red Hat and most other distros). If you read that page I linked to above you will gain a greater understanding of what is going on...

From what you are saying, I understood that all virtual hosts configurations are placed in "sites-available" as files and apache2 automatically includes them. I found the following line in the config file:

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

No it is the 'a2ensite' directiive that enables the sites (in effect it creates a symlink in sites-enabled to the relevant config file in site-available. Again that it covered in the Ubuntu Apache2 guide...

Sorry I didn't realise you wanted to use IPs. Just substitute the IP for the host name in the above instructions.

TBH if you can, I'd install ProxmoxVE to hardware and run them as separate VMs (like Chris suggested).

LeMOGO's picture

Chris and Jeremy,

Thanks again for your help.

I tried the stack from scratch, and it worked like a charm.

I used webmin and the little I knew how to use it, and I had no problem. It works as usual, even without me knowing the configuration files. I did not have to edit them manually.

I realize that V2 is very different from V1 and I will do more reading on it when I get a block of time.

Jeremy, I did follow your steps on the broken box, but it did not work. Someone else had work on this box after I installed it, so something must have broken then.
I have installed proxmox yesterday, but I can't seem to find the baby documentation that a noob would need. If someone knows where I can find good reading on the subject, please let me know. I have been reading the wiki and the help files from the site, but they lack the  basics that someone new to the subject would need to be able to make intelligent decisions.

I kept the broken to see if I can come up with a source and possible solutoing to the problem. I will report what happens in the next few days. If I can't resolve it, I will wipe it out and report that I did so.

Again, thank you for your help.

Chris Musty's picture

In as much as they possibly can turnkey is as turnkey as turnkey gets!

When testing web servers I rarely have to use webmin. Sometimes I install a few packages like curl but I use putty to ssh into my server for that.

In regards to a tutorial I created a quick overview of using containers in proxmox not long ago.
I am currently working on professional versions and will be posting them to youtube to link into the newly created turnkeylinux channel.

Download the above video and give me your feedback if I could make it better!

Chris Musty

Director

Specialised Technologies

LeMOGO's picture

Thank you for the video, Chris,

I don't know how I came across this video, but I happen to have downloaded it a couple of days ago and watched it. I just watched it one more time to make sure I did not miss anything, before posting back. I assume you are over that cold by now:).

That video is actually what helped me get started. I was able to get things running. My problem now is that I do not understand, even though I know what to do. This is a problem I have encountered throughout my learning of stuff that runs on linux. It's difficlut to "start". An example of what I mean in this case would be:

  • when I open the interface, the first thing I see on the top left iss the view: no idea when each is appropriate
  • then there's a "Datacenter" node on top; what's the concept behind it, and how does it tie with the rest (I see a hierarchy under it)?
  • If I want to configure proxmox itself, like changing its IP, where would I go?
  • ...

Simple basic things like the above make it difficult for non developpers/linux gurus to start understanding what they are doing. of course, step by step instructions work, and any dummy can click, but the lack of intelligence behind each click make it difficult to troubleshoot when issues arise. Besides, it's always better to understand what you are doing.

Your video tut (great job!) was very useful because it covers a good bit of the basics. I'm actually up and running (proxmox side - still reading about the environment). Everything I needed to get running was covered. Now, I'd like to understand. Any suggestions?

Thanks again for the support. Couldn't do it without you guy.

Thank you!

Chris Musty's picture

One of the things you will find in regards to linux is a rich community and an almost infinite array of tweaking, repurposing and customisation. One solution will probably never fit everyone but some projects come close. I suggest you check out one of the many linux tutorials and you will soon come to terms with the different ways to do things. Comming from a windows environment (which I have) is almost a detriment to learning allot of linux related  tasks.

Proxmox has user forums and you would be well advised to ask questions, some people love to help others and you will always find a regular in a forum (try beating Jeds Karma every month!).

Basically it will take time and effort, there is no easy way around it.

Chris Musty

Director

Specialised Technologies

LeMOGO's picture

Chris,

I'm sure I'm not the only one with this problem. I am more than willing to learn, and I'm an avid reader, but most of my time is spend jumping around with no clear path. I read the documentation online, and I'm still wondering about many things...

The videos were a life saver. I also watched the ones on the youtube channel.

When I started learning about this product,  the first hurtle was that I had to login. I was presented with 2 choices, and I made a guess (PAM). As I go along, I see features I wonder about because I am not versed in linux, nor in virtualization. I can pull my own weight, but it would sure be nice to have things "dumbed down" a bit in the documentations. If the documentation was written for kindergarteners, most of these products would have a larger user base.
Like most linux products, it just plain works! The only problem is that we remain ignorant after we've got it running. For example, I'm still trying to figure out what the concept behind the top node (data center) is... I drew my own conclusion, but I would not mind an "original" concept.
I understand that most of these products do not have the backing necessary to spend the time writing all these things down, but I'm pleading to all involved in helping us: please keep in mind that the people that really need and want to learn, need to hear those "obvious" things that you skip over. Please help us "understand" why we are doing it.
Being aware of the needs, and taking an extra few seconds to explain the obtions to the best of your ability would greatly help. I takes you a few extra seconds, but boy, oh boy! What a wild goose chase on our end when you don't!

I do not mean in any way to complain. I am just making a plea from a noob stand point.

Again, thank you all for your help and efforts.
 

Chris Musty's picture

Questions posted

 

  1. when I open the interface, the first thing I see on the top left iss the view: no idea when each is appropriate
  2. then there's a "Datacenter" node on top; what's the concept behind it, and how does it tie with the rest (I see a hierarchy under it)?
  3. If I want to configure proxmox itself, like changing its IP, where would I go?

Answers

  1. Assuming "open the interface" is refering to the proxmox web interface
    This needs some background first.
    Proxmox can be configured to have a parent node and child nodes (a cluster) so that the entire resource pool can be managed by one interface.
    I think your confusion comes because you are looking at a single server where the views are handy for clusters of servers showing certain resources on one interface.
    The different views are

    1. Server view - Shows all servers in the cluster
    2. Folder View - Shows all resources in the cluster
    3. Storage View - shows storage in the cluster
  2. Datacenter is the base hireachy ie it represents your "datacenter" so all resources naturally are a child of it. Your "datacenter" can be a single server or thousands of servers. Its whatever you define the parent and children as.
  3. I have recently done this manually and do not know of a way to do it through an interface (anyone feel free to chip in here). The problem you will have doing this is that all the virtual servers running on the PVE you are modifying will have to have their IP addresses modified if you change the network class. This goes right into network theory and thats a big subject. A typical home setup (or class C network) will allow for 254 addresses. If you change the IP within this range and there are no conflicts you should be OK. If you change the IP to a different network eg going from 192.168.0.100 to 192.168.1.100 you must modify all the virtual servers accordingly.

    So how do you do it?
    You need to modify /etc/hosts file if your server is public (domain name etc) but on a home server you will need to at least modify /etc/network/interfaces

    To do this try running the following command
    nano /etc/network/interfaces
    Then again if your not used to linux the comand line may baffle you!

    Here is a typical one from a turnkey appliance (this is what gets modified when you run confconsole and modify the network)


    \# UNCONFIGURED INTERFACES
    # remove the above line if you edit this file
     
    auto lo
    iface lo inet loopback
     
    auto eth0
    iface eth0 inet static
        address 192.168.0.104
        netmask 255.255.255.0
        gateway 192.168.0.1
        dns-nameservers 211.29.152.116 198.142.0.51 211.29.132.12
     
    auto eth1
    iface eth1 inet dhcp

 

Hope this helps and does not confuse you. I am certainly not the best at explaining things!

Chris Musty

Director

Specialised Technologies

Jeremy Davis's picture

But I can't help but chip in my 2c... :)

I agree with all your answers, but would add that part of my confusion when first using PVE 2.x was the apparent complexity of the interface (especially compared to 1.x). However once I realised a couple of things, it all became much clearer.

Firstly is to consider the intended audience. PVE 2.x is not really meant for home users, it's designed for enterprise. Having said that I still think its a great thing and as it's built on Debian it is really light and runs fine on consumer grade PC (desktop) hardware. I find it so handy to run all my home servers, and it's so handy to just boot stuff up to have a play with...

The second thing is that a lot of the interface is redundant in some respects. I mean that a lot of it is the same stuff, just displayed differently. From my understanding this is for 2 reasons; 1) To allow for different workflows (ie depending on what you are doing you can access the same info/settings in different ways), and 2) to allow for fine grained access/control to what limited userscan do. That leads onto what was almost a question... Regarding logging in to the WebUI. The one you chose (PAM) is for normal Linux users (I forget what PAM stands for but that's basically what it means AFAIK). The other option is for limited users. This means that (oince you set it up in PVE) you can delegate admin rights for specific machines to limited users. That is what I have done at home with my son. He has full admin rights over his Minecraft server and his LAMP server, without me having to give him access to the whole shooting match (not that he'd intentionally break anything, but he gets curious, just like I used to...)

Like Chris suggested PVE has pretty good forums and there is a lot of info there. I guess the only problem is that much of it relates to v1.x. Their Wiki is also quite good, although much of the v2.x stuff is still work in progress, good thing though is that all v2 articles are tagged as such to reduce confusion. They also have an active mailing list which could be a good place to ask questions.

LeMOGO's picture

And I was supposed to "figure" all this out?
Really?...

Man!
It is so much clearer!
Things of thie nature should be collected in a section and made a stickie on top of the first page!

Thanks a million!

I'm reading on the PVE site, but I could not find any of what you suggested here. Would you have links to suggest?

Jeremy Davis's picture

I also agree that there are significant 'base level' documentation missing (probably even moreso for TKL than PVE...) That definately makes the learning curve a little steep to start with, but a bit of playing goes a long way....

Don't mean to sound like some sort of hero or anything, but everything I know about PVE and TKL (and Linux in general) has been over the last few years of reading and asking questions online (forums and mail lists) and lots of trial & error... In fact trying to help other people has probably been my biggest teacher!

It sounds like you're quite passionate about it and have some really clear ideas about what is missing and what could be done about it. So here's a suggestion for you, how about you write some stuff up for the TKL Docs!? They're a community wiki so feel free to edit to your heart's content! :) Im fact, I think docs written for newbs by newbs, are some of the clearest (and most helpful for newbs) so don't hold back!

LeMOGO's picture

Jeremy,

Your suggestion is exactly what I intend to do. That is, as soon as I figure it out myself...

Part of the problem with documentation (which are actually training tools) is that it is written by teckies, and teckies are not necessarily teachers. The fact that you know what to do, does not  turn you into a good communicator. Fortunately, the tech audience is made of smart people that "figure it out. I just want to point out that things would be a lot easier for everyone if those who do the explaining would take a few more seconds to expand on the "obvious". That's what helps real noobs (people unfamiliar with the subject). More experienced people have less of a hard time figuring it out because they have the base concepts covered. The latter, regardles of how things change, can navigate their way around and *look* for what they *know* should be there.
My plea to anyone involved in the community, is to be aware of the hurtles, and make the effort to clarify things a bit (even if it seems trivial).

Thanks again for youe help!

Couldn't do it without the community.

Chris Musty's picture

I agree to an extent that documentation is lacking in allot of areas.

Documentation is not everything though, forums are probably one of the best tools around.
After all you did get these answers from a forum.

Chris Musty

Director

Specialised Technologies

Jeremy Davis's picture

:)

LeMOGO's picture

What would we do without forums?
I can't phantom such a world.

A forum such as this one documents experience and attempts, which is just as valid as the official documentation. Additionally, it fills needs that the written documentation can not (my favorite being that you get to interact with all kinds of smart people from all around the world).

While I agree with your view of forums, I think some basic things should be laid out so as not to need a forum to fill obvious needs. For example, I should not have to go to a forum to learn what TK is. Thank God there is a page for that! Some things should just be documented ...
Especially what you need to get going ...
Considering not everyone is as smart as you guys.

But I realize, most people are just concerned with getting their own problems solved and move on, and, some just don't have the time.

My plea to those involved is that "basics"/"obvious" be not overlooked, whether in writing documentation, or answering forum posts.

Ric Moore's picture

Everyone starts off as a Noob! The last time I used Windows was 3.1, after which I switched to Linux because I needed to assign seperate IRQ's to the 4 com ports to run 4 modems at once. Necessity IS the Mother of Invention! So, I've been doing Linux for a long while. I even worked for Red Hat for several years, all without one day of formal IT study. I've blown things up more than once and that has been how I learned, more and more, while there is a LOT I don't know still.

Like Promox. I just kept my install CD handy and played with it until something borked. I re-installed completely and didn't do that mistake again, and so on. I've been steadily dinking with it for about 4 weeks now and I am just starting to get a firm grasp of the ropes. These forums have been a blessing and I wouldn't be this far without them.

But, I am familiar with Linux from the command line and coming straight from a Win environment has to be tough when the cursor is blinking at you and you're wondering what to do next. Just think of it as DOS on steriods. You'll dump your Windows desktop and install Linux in short order, as you catch on. 

Me, I haven't looked back, I haven't seen a beg screen or a time-out telling me that my trial period is about to expire, nada. No viruses, if you take resonable precautions. Welcome!! You'll survive. : \) Ric


Ric Moore's picture

I have a static IP address to my proxmox box, with a router intercepting it and set to forward to the localnet IP address of it. I want apache to send http requests to the Turnkey packages that are installed on it. Yes, they all have the usual 192.168.*.* addresses. I'll set my DNS A records, at Network Solutions, to the various hostnames I have on the Proxmox box, using the same static IP address and let apache handle sorting them out to their respective containers. Do I have it right so far?? Am I getting it??

Or, is there an easier way to do this?? I am NEW to all of this virtual stuff and I'm trying to get a handle on doing it correctly. Thanx!!!   Ric


Add new comment