PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Dec 18, 2017 1:59 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: adding sites to LAMP
PostPosted: Sat Dec 16, 2017 1:32 pm 
Offline
Forum Contributor

Joined: Fri Sep 05, 2008 3:34 pm
Posts: 494
Location: Victoria, BC
I was wondering if it is easy to run a bash script or 5 to do the following

prompt for the domain the site will be using

make a home directory for the site under /home

then make a directory tree /home/site/www

create a vhost with apache vhost to point the site to the www folder

i guess a database can handle the site assets with MySQL tables?

_________________
Hardcore Games Legendary is the Only Way to Play!
Vegan Advocate 16 lbs grain to make only 1 lb meat, water for 6 months of showers and 34.1 lbs carbon dioxide
My sites are made with WordPress, which is a content management system, Joomla and Drupal are some alternatives


Top
 Profile  
 
 Post subject: Re: adding sites to LAMP
PostPosted: Sat Dec 16, 2017 6:45 pm 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6612
Location: WA, USA
Scripts don't normally "prompt" for anything (besides passwords). Pass the username/site as an argument.

If you're creating directories under /home then that suggests there are user accounts to go with it. Either create user accounts on the system or put the sites somewhere else.
Creating accounts would be safest as then the files can be owned by that user; make sure you chown the /home/site directory to match.

For the virtualhost, create a template file with tokens like $USERNAME or something. Then run the file through sed with appropriate replacements and save the output as a new configuration file. And restart/reload Apache.


Top
 Profile  
 
 Post subject: Re: adding sites to LAMP
PostPosted: Sat Dec 16, 2017 10:26 pm 
Offline
Forum Contributor

Joined: Fri Sep 05, 2008 3:34 pm
Posts: 494
Location: Victoria, BC
I was figuring /home/user would make it easier to jail the user to their home folder for security etc

_________________
Hardcore Games Legendary is the Only Way to Play!
Vegan Advocate 16 lbs grain to make only 1 lb meat, water for 6 months of showers and 34.1 lbs carbon dioxide
My sites are made with WordPress, which is a content management system, Joomla and Drupal are some alternatives


Top
 Profile  
 
 Post subject: Re: adding sites to LAMP
PostPosted: Sun Dec 17, 2017 12:41 am 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6612
Location: WA, USA
Putting them in one place like that is fine. What I'm saying is that /home specifically has a special meaning and is generally reserved for users of the system itself; if I saw a path "/home/site" then I would expect there to be a user named "site" to go with it. So my recommendation is to either (a) go ahead and have them in /home but create actual user accounts for them too, or (b) put the sites somewhere else.

The first option needs system privileges because you'll be creating users and groups. That's a bit annoying, but it has a great upside that all the files under /home/foo will be owned by the foo:foo user and group - you get Linux's filesystem permission system for added security.


Top
 Profile  
 
 Post subject: Re: adding sites to LAMP
PostPosted: Sun Dec 17, 2017 2:05 pm 
Offline
Forum Contributor

Joined: Fri Sep 05, 2008 3:34 pm
Posts: 494
Location: Victoria, BC
is there a web host package maybe that could be leveraged to make by VM look like another .COM

_________________
Hardcore Games Legendary is the Only Way to Play!
Vegan Advocate 16 lbs grain to make only 1 lb meat, water for 6 months of showers and 34.1 lbs carbon dioxide
My sites are made with WordPress, which is a content management system, Joomla and Drupal are some alternatives


Top
 Profile  
 
 Post subject: Re: adding sites to LAMP
PostPosted: Sun Dec 17, 2017 8:03 pm 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6612
Location: WA, USA
I don't know what you mean.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Bing [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group