Page 1 of 1

and configure web files rather from default /var/www/html to located in another DIR eg /var/srv/public/

Posted: 2018/07/02 09:19:10
by lse123new
In case I asked in an interview or exam
they are 3 web servers already installed on the system nginx, httpd, light_httpd
Activate the one you are familiar with - in my case httpd Apache -
systemctl start httpd
systemctl enable httpd

and configure web files rather from default /var/www/html to located in another DIR eg /var/srv/public/

this requires Virtual Hosts setup or just change in Apache conf files the default DIR and apply SELINUX CMD further below??? anything else? are onkly these settings change?

Bible Linux ebook extract

1)

To help you understand the settings that come in the default httpd.conf fi le, I’ve
displayed some of those settings with descriptions below. I have removed comments and
rearranged some of the settings for clarity.
The following settings show locations where the httpd server is getting and putting
content by default:

Code: Select all

ServerRoot "/etc/httpd"
Include conf.d/*.conf
ErrorLog logs/error_log
CustomLog "logs/access_log" combined
DocumentRoot "/var/www/html"
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
2)

5. If SELinux is in Enforcing mode (which is it by default in Fedora and RHEL),
set the SELinux fi le context properly on the content so SELinux allows the
httpd daemon to access the content:

Code: Select all

# chcon -R --reference=/var/www/html/ /var/srv/public/

Re: and configure web files rather from default /var/www/html to located in another DIR eg /var/srv/public/

Posted: 2018/07/02 18:06:38
by pjsr2
chcon only changes your SELinux file contexts temporarily. you will need "semanage fcontext" to make your changes permanent so they survive a reboot.

Re: and configure web files rather from default /var/www/html to located in another DIR eg /var/srv/public/

Posted: 2018/07/02 20:37:02
by lse123new
ok i will try
thks

Re: and configure web files rather from default /var/www/html to located in another DIR eg /var/srv/public/

Posted: 2018/07/16 06:41:02
by lse123new
Also if in an Exam I have asked

Setup in the same server Virtual hosts

like

intranet.servername.com # only local company network access . /var/src/intranet

production.servername.com # internet accessible public . /var/src/production

Basically what differences in conf settings should have these between ???

Re: and configure web files rather from default /var/www/html to located in another DIR eg /var/srv/public/

Posted: 2018/07/18 08:31:42
by lse123new
semanage fcontext
I tried this but error

semanage Not found
what to do???

Re: and configure web files rather from default /var/www/html to located in another DIR eg /var/srv/public/

Posted: 2018/07/18 10:52:19
by tunk
yum whatprovides semanage
yum install policycoreutils-python

Re: and configure web files rather from default /var/www/html to located in another DIR eg /var/srv/public/

Posted: 2018/07/18 14:18:30
by lse123new