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

Support for security such as Firewalls and securing linux
Post Reply
lse123new
Posts: 66
Joined: 2014/05/01 15:48:05

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

Post by lse123new » 2018/07/02 09:19:10

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/

pjsr2
Posts: 614
Joined: 2014/03/27 20:11:07

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

Post by pjsr2 » 2018/07/02 18:06:38

chcon only changes your SELinux file contexts temporarily. you will need "semanage fcontext" to make your changes permanent so they survive a reboot.


lse123new
Posts: 66
Joined: 2014/05/01 15:48:05

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

Post by lse123new » 2018/07/16 06:41:02

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 ???

lse123new
Posts: 66
Joined: 2014/05/01 15:48:05

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

Post by lse123new » 2018/07/18 08:31:42

semanage fcontext
I tried this but error

semanage Not found
what to do???

tunk
Posts: 1205
Joined: 2017/02/22 15:08:17

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

Post by tunk » 2018/07/18 10:52:19

yum whatprovides semanage
yum install policycoreutils-python


Post Reply