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

Thursday, April 30, 2020

Disable Directory Listing Apache2

Edit the following file:

/etc/apache2/apache2.conf

Remove 'Indexes' from default root directory setting:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

Updated apache2.conf file:

<Directory /var/www/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>

Restart the apache2 server instance.

Thursday, January 2, 2020

Default Web Server on Mac

The web server can be started on my in any directory through the following command:

# python -m SimpleHTTPServer 8000

(port number can be changed) 

or the default apache server can also be started through: 

# sudo apachectl start

The default localhost folder located here: /Library/WebServer/Documents or as per
configuration in apache2 config files.

Default apache is installed in /etc/apache2/ with all
its configuration files (httpd.conf).

Tuesday, July 16, 2019

Apache Reverse Proxy with mod_proxy

Follow the steps to install and configure apache as a reverse proxy. 

1. Install apache2 

    sudo apt-get update; sudo apt-get upgrade; sudo apt-get install apache2


2. Enable apache2 modules 

     sudo a2enmod proxy
     sudo a2enmod proxy_http
     sudo a2enmod proxy_balancer
     sudo a2enmod lbmethod_byrequests

3. Update apache2 default configuration file 

     sudo vi /etc/apache2/sites-available/000-default.conf

       <VirtualHost *:80>
              ProxyPreserveHost On
              ProxyPass / http://localhost:8080/
              ProxyPassReverse / http://localhost:8080/

              ErrorLog ${APACHE_LOG_DIR}/error.log
              CustomLog ${APACHE_LOG_DIR}/access.log combined
       </VirtualHost>

Multiple hosts:

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass /web http://localhost:8080/web
    ProxyPassReverse /web http://localhost:8080/web

    ProxyPass /micro http://localhost:8081/micro
    ProxyPassReverse /micro http://localhost:8081/micro
        
#ServerAdmin webmaster@localhost
#DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

4. Restart the apache2 server 
        sudo systemctl restart apache2





Friday, September 11, 2015

Apache2 and Create Virtual Hosts


Install Apache2 and Create Virtual Hosts:-

sudo apt-get update
sudo apt-get install apache2

1. Create website directory structure:-

sudo mkdir -p /var/www/python.bh/public_html
sudo mkdir -p /var/www/openstack.python.bh/public_html

2. Grant Permission:-
sudo chown -R $USER:$USER /var/www/python.bh/public_html
sudo chown -R $USER:$USER /var/www/openstack.python.bh/public_html
sudo chmod -R 755 /var/www

3. Create a html index page for each website
vi /var/www/python.bh/public_html/index.html
vi /var/www/python.bh/public_html/index.html

4. Create Virtual Host File and add site entries
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/python.bh.conf
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/openstack.python.bh.conf


sudo vi /etc/apache2/sites-available/python.bh.conf

<VirtualHost *:80>
        ServerAdmin admin@python.bh
        ServerName python.bh
        ServerAlias python.bh
        DocumentRoot /var/www/python.bh/public_html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Copy the same conf file for other server and update.

5. Register and Enable New Virtual Hosts

sudo a2ensite python.bh.conf
sudo a2ensite openstack.python.bh.conf


6. Restart apache2 server

sudo service apache2 restart

7. Add virtual host entries in hosts file.

127.0.0.1       localhost
127.0.1.1       openstack
192.168.48.128  openstack.python.bh openstack
192.168.48.128  python.bh  python


8. Access the website http://python.bh & http://openstack.python.bh
Note: For windows user add these entries in C:\Windows\System32\drivers\etc\hosts file.

192.168.48.128 python.bh
192.168.48.128 openstack.python.bh

https://code.google.com/p/openbizcard/source/browse/trunk/integrated/Scanner/src/com/yov/lib/?r=103

http://www.gnome.sk/Twain/jtp_try&buy.html


AWS EC2 - SSH locked with UFW

Need to update the instance's user data: 1. Stop the instance 2. Right click (windows) or ctrl + click (Mac) on the instance to open a c...