Showing posts with label apache2. Show all posts
Showing posts with label apache2. Show all posts

Friday, November 12, 2021

How to redirect http requests to https?


Add the following lines to the /etc/apache2/sites-enabled/000-default.conf file in side <VirtualHost *:80> </VirtualHost> block (In debian based linux)

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Monday, January 16, 2017

How to fix/suppress "apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1." warning message?



Warning message Before the fix:

"apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message"


Fix: 
execute the following command in terminal

echo "ServerName localhost" | sudo tee -a /etc/apache2/apache2.conf

Now restart apache server by executing the following command

sudo /etc/init.d/apache2 restart


Message after the fix:
[ ok ] Restarting web server: apache2.

Sunday, March 3, 2013

How to create a Linux repository for the intranet/local machines?

1. Copy the whole repository of a particular linux distro(BOSS Gnu/linux, ubunutu) into a harddisk(external/internal), either by debmirror command or request/contact to the repository maintainers.
 1.1 Copy the repository using debmirror
   $debmirror -a -d -s --method= -h --root= --no-source --progress --ignore-release-gpg 
   switch a - architecture, d - distro etc..  Note: For more information read man pages of debmirror

ex: 
$debmirror -a i386 -d savir -s main,main/debian-installer --method=http -h packages.bosslinux.in --root=boss --no-source --progress --ignore-release-gpg /home/test/repository


2. install apache2 web server using
 $sudo apt-get install apache2

3. Either copy the whole content distro copy "/home/test/repository" to "/var//www" directory, or give a link to /home/test/repository in /var/www

4. find the ip address of the machine(where you do all the above procedures. i.e machine in which you keep the local/intranet repository/server) using
 $sudo ifconfig

5. add the following line as first entry in the  /etc/apt/sources.list file of all the linux machines that connected to the intranet as follows
 deb http:///boss savir main contrib non-free

6. Try apt-get update from the client machines if it updates fine, everything is fine.  Your local intranet repository is setup successfully.