apache setup multiple doc root - apache

I have apache2 server with a private IP.
Also, I have multiple applications that need to run on the same server.
Is there any solution to setup different document root for each application
Like ..
http://xx.xx.xx.xx/application to doc root /var/ww/html
http://xx.xx.xx.xx/application1 to doc root /var/www/html/app1/public
http://xx.xx.xx.xx/application2 to doc root /var/ww/html/app2/public

Related

How do I make the Apache Server point to the /var/www/html directory

In a new RHEL 7.5 server, I have created a var directory and within that the /www/html directory in which my website resides. When I try to access the website, I get the Apache Server Test page and mentions that the Apache server is running and I need to point to the /var/www/html directory.
How do I point the Apache Server to the /var/www/html directory?
You need to configure the available-sites and enabled-sites and remember to restart apache after changes in the config files.
Have a look at this guide:
https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts#step-four-%E2%80%94-create-new-virtual-host-files

Using LetsEncrypt and Google webmaster tools with gitlab ce

I have used certbot to obtain SSL certificates. At that time ubuntu's default apache server was listening on port 80. Assume my server is accessible via example.com.
Now, I am running a GitLab CE 9.4.4 server using the SSL certificate I have obtained earlier with letsencrypt. In /etc/gitlab/gitlab.rb I same something like this
nginx['ssl_certificate'] = "/etc/letsencrypt/live/example.com/fullchain.pem"
nginx['ssl_certificate_key'] = "/etc/letsencrypt/live/example.com/privkey.pem"
(and similar lines with registry_nginx for the docker registry.)
However, certbot renew fails, when it tries to renew my certificates, since /var/www/.well-known is not accessible via http://example.com/.well-known.
A similar problem arises, when one tries to use Google webmaster tools. The default verification process requires you to upload a file named googleXXXXXXX.html into the server's root directory.
How can GitLab be configures to server static files in .well-known and files starting with google?
(Unfortunately, a Google search containing gitlab and static files, produces results about GitLab pages.)
Via GitLab Webroot
The webroot of GitLab CE on Ubuntu is /opt/gitlab/embedded/service/gitlab-rails/public by default. You can copy the googleXXXX.html into this directory and point LetsEncrypt's webroot to this directory:
...
[renewalparams]
authenticator = webroot
installer = None
account = SOMEHASH
[[webroot_map]]
example.com = /opt/gitlab/embedded/service/gitlab-rails/public
Via GitLab Config
Configure LetsEncrypt
Open the letencrupt renewal configuration, e.g. /etc/letsencrypt/renewal/example.com.conf, and adjust the options, such that the web root points to /var/www/letsencrypt:
...
[renewalparams]
authenticator = webroot
installer = None
account = SOMEHASH
[[webroot_map]]
example.com = /var/www/letsencrypt
Create the directories /var/www/letsencrypt and /var/www/letsencrypt/.well-known. The latter directory will host the verification challenge files.
Configure Webmaster tools
Create the directory /var/www/google and download the googleXXXX.html it into the newly created directory.
Configure GitLab (for LetsEncrypt and Webmaster tools)
Open /etc/gitlab/gitlab.rb and add the following two lines.
nginx['custom_gitlab_server_config'] = "location ^~ /.well-known { root /var/www/letsencrypt; }\n"
nginx['custom_gitlab_server_config'] << "location ^~ /google { root /var/www/google; }\n"
Reconfigure your gitlab server by running
gitlab-ctl reconfigure
All requests, which start with /.will-known will now be forwarded to the /var/www/letsencrypt directory. Similarly, all requests starting with /google are forwarded to the directory /var/www/google. (Please note, that this approach makes users or group starting with google inaccessible. In this case you can change the gitlab config to include the full name of your googleXXXX.html)

document root at /home dir for new user

I have just installed a new LAMP server inside Ubuntu server. This was done using tasksel, while login as root user. I want to move apache document root into /home directory. Please advice, should i create new user other than root or just go with root and place the document root under eg. /home/public_html ?

How disable direct call files on web dirrectory?

My server was built on Apache and Nginx.
There are some directories with js scripts Node on root directory web site.
Via url address i can call direct file such like: domen.com/node/notific.js
How as it can be blocked?
I saw apache tutorial and found that it possible set in apache2.conf, to specify here in the Servername part param index-options, but it acts only on the prohibition directories.
And what you advice check me for more security my directories?
Thanks

Apache configuration, Setting document root or virtual host

how can I say to apache to go to look in the /home/user/Web folder for the project without missing the possibility to display localhost/phpMyAdmin. Itried with Alias, Document root an Virtual Host.