Apache



Version
    php --version
    /usr/sbin/apache2 -v




Options
/etc/apache2/sites-available/default
Error Log
/var/log/apache2/error.log






maximum upload size 2M usually for development and back-up recivery purposes set it to 64
/etc/php5/apache2/php.ini

Options
/etc/apache2/sites-available/default
Error Log
/var/log/apache2/error.log


Apache

Install
        sudo apt-get install apache2
I tried to install apache http server from source file. it ran and worked correctly binding to the port 80. but it didn't make the /etc directory for me. My purpose was to use subversion in http protocol. This didn't work, so I had to do the sudo apt-get install apache2 again

Directory
        /etc/apache2

Config File
        /etc/apache2/apache2.config

DocumentRoot
        /var/www

Start
$ cd /.../apache2/bin
$./apachectl start
$./apachectl stop
$./apachectl restart

OR

$ sudo /etc/init.d/apache2 restart
$ sudo /usr/sbin/apache2ctl start
$ sudo /usr/sbin/apache2ctl stop
        

Home Address
        http://localhost/





Subdomain for Localhost

$ sudo vim /etc/hosts
add line:
127.0.0.1       subdomain.localhost
create a new configuration file in /etc/apache2/sites-available, and then enable the new site with the command a2ensite
$ sudo vim myConfig
Put the following lines in the file:
<VirtualHost *>
        DocumentRoot /home/username/mysite
        ServerName subdomain.localhost

        <Directory /home/username/mysite/>
                Options Indexes FollowSymLinks MultiViews +Includes
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

$ sudo a2ensite myConfig
$ sudo /etc/init.d/apache2 restart

Now you can browse to http://subdomain.localhost/



-----
The information of the directories could also be in the active httpd.conf   e.g.  /usr/local/apache/conf/httpd.conf  specially in cpanel.

Add Virtual Host   

here virtual host is not in the httpd directory of apache and is totally outside. You do not need to set any permissions outside of the following. imagine if the website you are designing is grocery.com, to develop it locally have a subdomain lc which you are sure is not a subdomain of your website.

~/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
    #ServerAdmin postmaster@dummy-host2.localhost
    DocumentRoot "D:/ShahriariNia/Resources/My Dropbox/workspaces/Grocery/codeigniter"
    ServerName lc.grocery.com
    <Directory "D:/ShahriariNia/Resources/My Dropbox/workspaces/Grocery/codeigniter">
          Options Indexes FollowSymLinks
           AllowOverride all
           Order allow,deny
           Allow from all
           Require all granted
    </Directory>
    ##ServerAlias www.dummy-host2.localhost
    ErrorLog "logs/lc.grocery.com-error.log"
    CustomLog "logs/lc.grocery.com-access.log" combined
</VirtualHost>

127.0.0.1 lc.grocery.com


For example, suppose that you are serving the domain www.domain.tld and you wish to add the virtual host www.otherdomain.tld, which points at the same IP address. Then you simply add the following to httpd.conf:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain
</VirtualHost>

<VirtualHost *:80>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>












Comments