[SOLVED] How to setup my own private web hosting server, for myself only.
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to setup my own private web hosting server, for myself only.
Data: CentOS7, Apache, Mariadb, php, H/W-mem: max 20G
I don't think I can find the correct words to find what I'm looking for so I'll ask you guys.
I want to setup a web hosting server but for myself only.
It should be as close to as any real one, like the added account fixes a database/access, generate passwords, create ftp/fpts etc with it's own password etc.
This is just for me to test things and to easily add a new website with a new domain name with ease so preferably at no cost except H/W and such.
-If no one knows anything, what words should I use to get info of this?
-Is there an addon for webmin, or multiple addons? if not, where do I read up on all this.
-Is there a bash script for this? and hopefully to do it all after a few questions, creating DB, ftp-user, homedir, access etc but if no problem if they are separated.
-If totally manual for each step, what's the best setup, create the web files in the user home dir, sure no worries there but if so what about the database, it has no virtualhost, like different dir's, does it?
It is true that your goal is unclear. You can search the internet for centos set up LAMP, and you will get generous results. Digital Ocean tends to have good cookbooks.
Most probably, creating a LAMP server is the easy step. Filling it with content is the real problem: You will have to think of a data model that you will turn into a DB schema, then templates that implement the looks of your web site, and how to tie everything together. Websites normally use the MVC architectural pattern, Model-View-Controller.
Also look up frameworks, which allow you to map your data model to the database, implement authentication etc.
You may want to start with a server for static web pages without DB and PHP.
Code:
yum install httpd
and create the pages under /var/www/html. Don't forget that the Centos firewall blocks practically all traffic; to allow web traffic, use firewall-cmd.
If you want to do this on a home computer with no public facing, you might want to look at XAMMP. It includes phpMyAdmin.
XAMPP can be considered adequate for those stuck running Windows but gets in the way of modern systems in several ways. Regular LAMP should be pursued if it is an option and CentOS 7 will certainly be able to support standard Apache, Mariadb, and various scripting languages such as PHP/Python/Perl.
Unless FTPS is a hard-coded requirement, I'd stongly advise against wasting effort on it and instead use regular SFTP. SFTP is far easier to set up and get through the firewall and is more secure.
However, in general, it'd be good to hear about what kind of hosting the OP wants. It may very well be that the hosting requirements are better met with a static site generator like Hugo, Pelican, or Jekyll instead of a heavy CMS like WordPress. The static site generators combine the best of both worlds for quite a few use-cases. For smaller sites, XHTML+CSS+SSI would have even fewer moving parts.
To be more informative as it seems I didn't seem to get my thoughts out.
I have done a lot of LAMP installations although not using this bundle, installing everything
Now I want to be able to let the main users/webadmins who I set all these sites up for to log in and manage it, change things etc before it's time for upload to a real web hosting service and use the real domain name.
With my normal setup I use the same MariaDB daemon but different databases but this will not work as each user do not have their own instance thus see all databases, or?
When you think of any(?) web hosting, you get FTP access to the files with one login and another for the database and in this you only see our own db and it's this type of setup I want. I wonder know how a web hosting service can do this one instance of MariaDB? is it possible?
I tried to let FTP access the web files in each subdir under /var/www... with SELinux context as httpd and it seems it won't work or I'm doing something wrong. The web files can be put in the users home dir, set the appropriate SELinux context and this is not a problem anymore with Apache but now... how about FTP? my problem is the database.
Did you check ISP config - this is not something on the Internet, you can install it on your server and you have almost the same user experience as with C-Panel.
Webmin can be configured to limit what users can see and do.
Quote:
With my normal setup I use the same MariaDB daemon but different databases but this will not work as each user do not have their own instance thus see all databases, or?
MySql/MariaDB can be configured the same way, so that a user can only see and manage their one database(s) within a single instance. Read up on privileges. Each user should not see all databases.
OK, I'll have a look at ISP config, I'll check with them about Hugo, Pelican, Jekyll and OK about the user access in MariaDB, I'll look more into that.
What about the web files? To get an FTP setup so the user can do anything with them, where should I place them?
I usually use /var/www/... but some times I move away from that directory to a separate drive with better speeds and RAID:ed but I'm more and more thinking that instead of moving that standard directory, I will mount the separate disk under it instead, a lot less hassle with SELinux
I can't find any example how to setup eg. wuftp, proftp, vsftp to be able to access the web files if they are in /var/www/html/userx/filesxxx... so I'm thinking of moving them, per user, into their own home dir, but that also adds some SELinux context changing, but that's OK but then I don't know if the daemon can access them since the context changed...
As you see I'm not natively English speaking so I got some problem to create the right question with the right words for the search engines
The thing with the ftp to access the files is when using Wordpress, this application can't use ssh, only ftp/ftps and this kinda sux, this is why I need this ftp-thingy.
A user has a home directory. If that user's home directory is /var/www/html/user1 then (s)ftp will upload to that directory, which is where the web content is served from when the domain is configured to use that directory as the DocumentRoot.
I will typically give a customer one login/username for (s)ftp and a separate username for email, as the user's email shouldn't be in the web space.
A customer with several domains will have several spaces in the web space:
Code:
/var/www/html/user1/domain1
/var/www/html/user1/domain2
/var/www/html/user1/domain3
etc.
All accessible via (s)ftp using the user1 login. I have one customer with 13 such.
I think I got that the answers that helped me out so I'll close this thread, I might be opening it up again, but I doubt it as I got lots of things to search and test, thx
- I will absolutely try out ISPConfig cos that sure looks interesting (saw a UT-vid about it but daaang, installed like every PHP-module there is... ,
can't say it was for ISPConfig or 'just in case', if the latter... that sux.
(Check video: https://youtu.be/kah1PzC1gzo?t=525 why install package for mssql?? )
- Why I didn't know that a database specific admin user only could see it's own database gotta be that I always use super user when handling MariaDB so.... ooops
- Tried ProFTP again and it worked. I can't say what I did wrong last time since it couldn't list any files in the /var/www... directory but now it can see them all
and hopefully also add/del/mod them all, haven't tried that yet.
- Looked a bit on XAMPP but I didn't get why this is better than LAMP or as I do, install all 'em all by hand? OK it also has Perl, but when do I use that? Haven't so far.
Well think that is all.... at least that I can think of.
Thanks again and...
UPDATE: Just saw that Webmin uses Perl so, sorry
Last edited by Basher52; 11-15-2019 at 03:23 PM.
Reason: Just saw that Webmin uses Perl, so... oops :p
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.