Posts

Showing posts with the label Apache

Reverse-Proxy in apache2.

Follow the below blog. How To Use Apache HTTP Server As Reverse-Proxy Using mod_proxy Extension.

Set Up Apache Virtual Hosts on Ubuntu.

Prerequisites: You have to install apache2 in your os. For this follow my previous blog Install apache2 in Ubuntu.   Step 1: Create new host. Open terminal(ctrl+alt+t) and paste below code > sudo gedit /etc/hosts Now edit the file. Means add new host name and port.Example add below line > 127.0.1.1    example.com Now save and close the file. Step 2: Create the Directory Structure. Create new folder in /var/www/    directory . For this execute the below line> sudo mkdir -p /var/www/ example.com /public_html   Step 3:  Grant Permissions.Now change permissions to enable regular user to modify files in our web directories. For this execute the below line> sudo chown -R $USER:$USER /var/www/ example.com /public_html   We should also modify our permissions a little bit to ensure that read access is permitted to the general web directory. For this execute the below line > sudo chmod -R ...

Install apache2 in Ubuntu.

sudo apt-get update sudo apt-get install apache2 Restart apache so that all of the changes take effect: sudo service apache2 restart

How to enable cross origin in apache.

Step 1: To enable cross origin in apache2 you need enable mod_headers . To ensure that it's enabled by run below command in terminal. a2enmod headers   Step 2: Next add the following line inside the sections of your server config (usually located in a *.conf file, such as httpd.conf or apache.conf), or within a .htaccess file.   Go to /etc/apache2   Then copy paste the below line: sudo gedit apache2.conf Add below lines: <IfModule mod_headers.c> Header always set Access-Control-Allow-Origin "*" Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, PUT, DELETE" Header always set Access-Control-Allow-Headers "access-control-allow-origin, authorization,content-Type,x-requested-with,accept,origin,access-control-request-method,access-control-request-headers" </IfModule> Finally save the apache2.conf file and reload the apache service running below code:   sudo service apache2 reload   Enjoy.. ...