I have installed LAMP locally and am attempting ot run my website internally … have downloaded the site and imported the MySql database sucessfully into my local machine. Apache and php have been installed and talk to one another. The point i am stuck at is getting the DocumentRoot to point to my user directory ~/www.
I have researched and found some instruction but none for the Open Suse system. Although i have found the default-server-config file I am completely over my depth with its internal structure and just what i should do to make the server point to my /home/user/www directory.
A personal contribution or a link to some specific instructions are equally fine …
AFAIK you need mod_userdir active. Another solution I’ve seen is to symlink f.e. /home/user/www to /srv/www/htdocs/whatever.
But, my advice will always be to stay as close to the defaults as possible, i.e. have /srv/www/htdocs as the server’s webroot and use vhosts for everything in there. In fact, I never actually use the server’s webroot, but create vhosts for ‘webroots’ in the server’s webroot.
Thanks for that. However i am interested in having the DocRoot in my local users directory so i can develop without having to be su … i just want to have a local/www so i can play with template sites … edit as i see fit … hit the browser to check. When i have something i am happy with i can just upload the files to my Internet Host Site and all is good!! To be able to mess about locally would be a great advantage … but i cannot get past this.
I have searched far and wide … can find nothing that helps me out as all the technical manuals are just beyond me … i am just looking for a simple guide to be able to point the server to my local directory … nearly all the stuff i can find does not pertain to the OpenSuse file system and so i cannot follow them … even installed ‘HTTP Server Config’ for yast … but again, no idea what i should change there … I did change the DocumentRoot however but all i get is the dreaded Access Forbidden!!
What I think I understand is that you want to be able to develop your HTML and CSS (and maybe CGI and PHP) files of your website and then look at the results just by editing, storing what you edited and then load the page in the browser to see the results.
That is easy enough. It typically asks for a user on your system that is owner of those files and that is also member of the group www. Then when you see that that user and group www own the files and that there is read permission for group www, the Apache processes that run with user wwwrun and group www will be able to read the files and serve them top the browser.
For that user, you can use wwwrun, but I prefer another one specially created because the system defaults are that wwwrun can not log in at all and while you can change this, I like the solution of another user that then can log in in a GUI and have his own environment and help files, etc. that can then also moved to a newer installation (or system upgrade with ease) without any change to the openSUSE installed user wwwrun.
Thus:
create a new user with a nice name and www as primary group;
make /srv/www and all in it (recursive) owned by that user and group www;
log in in the GUI with that user using the DE you prefer.
You can then edit all you like with the editor you like and the Apache processes will be able to display them.
As mentioned above, you can have symbolic links from a place in a user’s home directory to a place with /srv/www, but you then still need to adapt permissions in /srv/www so that that user can edit (rw either for the world, or for the group and then make the user member of the group).
You can also use an Alias in your Apache configuration that points to a place within a user’s home directory. But then this files must be readable for the Apache processes, which means that they should be world readable, which you may not want.
So several solutions. What they all have in common is that you should have a good understanding of Unix/Linux file ownership by user and group and permissions and process ownership by user and group. Something you should have in any case because else the infamous “permission denied” messages will be upon you.
On Sun 07 Oct 2018 09:26:03 AM CDT, griadooss wrote:
Knurpht;2882467 Wrote:
> AFAIK you need mod_userdir active. Another solution I’ve seen is to
> symlink f.e. /home/user/www to /srv/www/htdocs/whatever.
>
> But, my advice will always be to stay as close to the defaults as
> possible, i.e. have /srv/www/htdocs as the server’s webroot and use
> vhosts for everything in there. In fact, I never actually use the
> server’s webroot, but create vhosts for ‘webroots’ in the server’s
> webroot.
Thanks for that. However i am interested in having the DocRoot in my
local users directory so i can develop without having to be su … i
just want to have a local/www so i can play with template sites … edit
as i see fit … hit the browser to check. When i have something i am
happy with i can just upload the files to my Internet Host Site and all
is good!! To be able to mess about locally would be a great advantage …
but i cannot get past this.
I have searched far and wide … can find nothing that helps me out as
all the technical manuals are just beyond me … i am just looking for a
simple guide to be able to point the server to my local directory …
nearly all the stuff i can find does not pertain to the OpenSuse file
system and so i cannot follow them … even installed ‘HTTP Server
Config’ for yast … but again, no idea what i should change there … I
did change the DocumentRoot however but all i get is the dreaded Access
Forbidden!!
Hi
All you need to do is enable the usermod extension and then develop in
~/public_html?
–
Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
SLES 15 | GNOME Shell 3.26.2 | 4.12.14-25.19-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!
That is also a possibility.It seems that it is not really save to use (my ISP stopped using it years ago for security reasons and gave it’s customers a “normal” place to use), but as long as you do not expose the server to the Internet, I assume you are pretty save (depending on who roams your LAN).
FWIW: No matter the webroot from websites/apps I develop, I locally use the default server webroot / vhost. When I sync, I simply bypass configs, the rest goes to test.domain.com, after qa to domain.com. The files in the test domain are owned by my user ( I also work directly with Kate over sftp connections ). A script, run as the webuser does the syncing to the domain.
Now, why all this? Simply because I don’t have to tinker with a system’s default. The procedure makes me able to work independent from defaults on other webservers. Default webroot /var/www/html or whatever? All OK. This way I don’t have to recreate other systems’ directory structures. If I would like to work from my home folder, I’d create a public_html ( old default ) symlink in my $HOME.
The bigger idea? Setup default system webserver - work on your actual work.
To be honest, it took me a couple of years and a lot of messing around editing config files on non-openSUSE webservers before I found the simplicity and efficiency of this procedure :D.
I don’t see anywhere in any post in this thread that you’ve used the YaST HTTP server module.
Have you tried setting up using it?
If you had,
You’d have found that this module in screen 3/5 sets up your default website and can specify any location you’d like.
Also, the following screen 4/5 allows you to set up virtual hosts if you prefer to set up that way.
But,
Before you do any of this (configuring a website document host in your home directory)
Consider the permissions you’re setting up (which may or may not be related to your file location).
You <don’t> want to configure anything less than root or special permissions to edit files because that could open your website up to compromise (hacking).
Development tools often run in the context of root for this reason, to make sure no ordinary or passing User can make unauthorized changes to your website or application.
If you doing private development and only need to deploy your files momentarily for development purposes and not for Production deployment, then I’d suggest you consider a script based http server instead of Apache. Every development language today (eg python, perl, javascript) has such a server that you can invoke on demand and in any file location mainly for development purposes. Once you have your code working, you can then migrate to somehting like Apache.
But, many people do prefer to develop directly on Apache, and in those cases IMO you should simply set up the appropriate environment writing to an Apache with document root somewhere in /srv/www/*
That is, unless you’re pointing to a VPC without access to that location… In which you’d follow guidance from your VPC provider.
Well … i did mention it … i had installed it after learning of its existance during research (it as it was not on my system by default)
… but as i said, it is not friendly enough for me to use without some guidance.
If you had, You’d have found that this module in screen 3/5 sets up your default website and can specify any location you’d like.
… and that is the part i did understand and was able to do … however, all i get is the dreaded “Access Forbidden!!” response.
You <don’t> want to configure anything less than root or special permissions to edit files because that could open your website up to compromise (hacking). Development tools often run in the context of root for this reason, to make sure no ordinary or passing User can make unauthorized changes to your website or application.
Okay … i was unaware of that!! … and of course it makes sense. That helps with my understanding of best practices. Thanks
If you doing private development and only need to deploy your files momentarily for development purposes and not for Production, then I’d suggest you consider a script based http server instead of Apache. Every development language today (eg python, perl, javascript) has such a server that you can invoke on demand and in any file location mainly for development purposes. Once you have your code working, you can then migrate to somehting like Apache.…
Yes! That is me
But, many people do prefer to develop directly on Apache, and in those cases IMO you should simply set up the appropriate environment writing to an Apache with document root somewhere in /srv/www/*
Also yes! … same here, i want to learn how this ‘web stuff’ works … so can’t shy away from it. lol! Thank you for all the tips … i am now better aware!!
Serveral solution? … yes, i want to look at them all. I have a rudimentary understanding of file ownership and permissions … but it has been a while and i should put myself through a refresher program. Thanks for the advice.
What I think I understand is that you want to be able to develop your HTML and CSS (and maybe CGI and PHP) files of your website and then look at the results just by editing, storing what you edited and then load the page in the browser to see the results.That is easy enough. It typically asks for a user on your system that is owner of those files and that is also member of the group www. <clip> For that user, you can use wwwrun, but I prefer another one specially created because the system defaults are that wwwrun can not log in at all and while you can change this, I like the solution of another user that then can log in in a GUI and have his own environment and help files,
Okay … i am starting to understand! This flavour is mentioned by TSU. It seems straight foward enough. Thank you for the great explanation!