LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-02-2021, 12:33 PM   #1
pavllvap
LQ Newbie
 
Registered: May 2021
Distribution: Gecko Static Plasma
Posts: 24

Rep: Reputation: Disabled
New LAMP, virtual host container, change Apache2 root, best practice?


Beginner with a new LAMP on Gecko Static Plasma.
I have a root partition btrfs and a home xfs.
LAMP as default settings so I have /srv/www/htdocs with test html & php files only.

Was previously reading about Flask, Laravel and Python and the advice in that arena was always (repeat always) run development web within a virtual container of some sort.

Tried reading about virtual hosts related to Leap 15.2 and came up with some old stuff from other distros but was unable to sift it out to make sense for my situation.

My questions are ...
Is it good/best practice to create a virtual container for some website development work (not public/production for a LONG time)?

Is it a good idea to change the root directory for all work(html, python etc) to /home/somedirectory ?

And I quote from /etc/apache2/vhosts.d/vhost-ssl.template file .....

Quote:
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
And having been warned, my teeth are chattering ....

The OpenSuse documents are very thin for beginners. Those for other distros (inc Windows) 'seem' to offer conflicting advice.

Is there a place to go to read ?

In the end my aim is to learn and practice with the conversion of a MS Access database into a test/development simpler version using SQL,html,php and a bit of ajax/javascript.
Very long term practice project ... no intentions of worrying Google !
 
Old 06-02-2021, 03:49 PM   #2
captain_sensible
Member
 
Registered: Apr 2010
Posts: 352

Rep: Reputation: 145Reputation: 145
its a bit unclear what your objectives are ; i've recently installed arch vanilla and so have gone through the process of setting up a web server apache , not using a static IP and won't be allowing the public acess but simply for use of web development specifically php.

if you put say index.php or index.hml in the web sever root (for me its /srv/http) that fine. The pragmatic use of virtual hosts is so that you can have several web development directories and configure it so that you can use a web browser to use each one as requied. Now flask is python , laravel is php so can you code both python or/and php ?

Larvavel is one php framework have a look at codeigniter4 for an alternative.

putting it simply if apache is for web devonly then get it to listen to : 127.0.0.1:80
 
Old 06-03-2021, 02:38 AM   #3
pavllvap
LQ Newbie
 
Registered: May 2021
Distribution: Gecko Static Plasma
Posts: 24

Original Poster
Rep: Reputation: Disabled
Thank you - captain_sensible.

My first target is to set up this LAMP in a way that is considered to be "good practice".

Was only mentioning the frameworks because I was advised earlier that this was the way to go ... then realised they imposed additional layers between me and what was intended to be a straightforward structure, so decided I would learn more by using the old fashioned methods.
But as these required Linux I started down this path ... but now realising it is no longer strictly necessary to achieve what I want ... but continuing in the belief that I will learn more.

But finding the restrictions on /root for file creation and editing a bigger molehill than I was expecting.
A few years ago was practicing with Atom and Bluefish and Notepad++ and was able to create and edit files in the dev server "www" folder easily and quickly. (in Windows)

Wish to use it as a single web server for only development work to create a SQL database 'version' of my existing accdb.

So do not want multiple instances ... just reading the opinions of others and finding a variety of them and trying to sift out the reliable/standard/safe methods.

Not needing or wanting cutting edge, far from it, prefer the blunt back edge. After all, I am working with what Mr Torvalds describes as possibly the most boring of subjects ... a database.
 
Old 06-03-2021, 07:48 AM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,520

Rep: Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494
Quote:
Is it a good idea to change the root directory for all work(html, python etc) to /home/somedirectory ?
Do you mean instead of /srv/www/htdocs? Not sure of the purpose but there should be a public_html directory in your /home/user directory but that needs to be configured in your httpd configuration files before you can use it. If that directory does not exist you can create it but you will still have to configure it to be used in your Apache configuration files.

Quote:
But finding the restrictions on /root for file creation and editing a bigger molehill than I was expecting.
I'm not sure I understand that comment. You refer to /root which is the root user home directory and there is no reason I can think of to be using that with Apache.

There should be no problem creating directories and files in the /srv/www/htdocs directory, you need to set correct permissions and ownership on them.
 
Old 06-03-2021, 12:03 PM   #5
pavllvap
LQ Newbie
 
Registered: May 2021
Distribution: Gecko Static Plasma
Posts: 24

Original Poster
Rep: Reputation: Disabled
Thank you - yancek.
My wrong terminology I think.
I installed with two partitions so I have btrfs as Gecko OS plus a "home" as xfs.
So I got the description wrong and meant to say ...
I want to put the web files all in one directory within this "home" partition which is shown as my username in Dolphin.
But you had guessed that ...

And had read a bit about the httpd config files but had not made sense of slightly differing opinions ... intend to return to that reading and sort it out.

One opinion (unable to find it now of course) stated that I should never mess with permissions on the default apache installation. Not questioning your advice ... just saying that for beginners we have to listen to a wide variety of opinions and there is sometimes enough differences to make it impossible to choose.

As a comparison I am quite content to change the Windows registry keys, delete and rebuild bios boot etc with advice from a trusted forum because there is a single, tried and tested voice with a huge user base.

As for the comment about "molehill" and creation/editing files ...
Was able to follow advice and run nano and then to save out a new html and php file in /srv/www/htdocs ...
BUT ... my problem is simply one of finding that process very cumbersome and of being unpracticed and unsure. Just needs more practice.

Just used to Windows, thats all.

I think I will leave this topic now and do a lot more reading and practice.

Thanks for your help and guidance.
Paul
 
Old 06-03-2021, 06:39 PM   #6
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,520

Rep: Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494Reputation: 2494
Quote:
I should never mess with permissions on the default apache installation.
I was referring to sub-directories of the apache install, in your case directories/files under /srv/www/htdocs. Giving a user ownership or permissions there should not be a problem.

Anyhow, good luck with it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Container Networking Best Practice stampede Linux - Containers 2 01-09-2021 06:16 AM
Additional virtual host redirecting to other virtual host website ubuntu server 16.04.3 whissama Linux - Newbie 1 05-03-2018 11:13 AM
linux container host os and container os question jzoudavy Linux - Newbie 1 09-01-2015 05:21 AM
Virtual host inside Virtual Host, apache2 pinguim007 Linux - Server 1 08-22-2013 02:49 AM
[SOLVED] Apache2 - virtual host defaulting to default host slimjim Linux - Server 1 10-31-2009 01:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration