วันอาทิตย์ที่ 27 กันยายน พ.ศ. 2558

Add hostname localhost[Ubuntu]

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/km1.conf
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/km2.conf

command edit

sudo nano /etc/apache2/sites-available/km1.conf
sudo nano /etc/apache2/sites-available/km2.conf

edit file km1.conf

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost1
        ServerName localhost
        ServerAlias www.localhost1
        DocumentRoot /var/www/...Systemname...

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
edit file km2.conf

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost2
        ServerName localhost
        ServerAlias www.localhost2
        DocumentRoot /var/www/...Systemname...

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
Active file

sudo a2ensite km1.conf
sudo a2ensite km2.conf

Disable file

sudo a2dissite 000-default.conf


Command host file command

sudo nano /etc/hosts

Edit host file

127.0.0.1  localhost1
127.0.0.1  localhost2 

Finally, restart the apache service.
In Ubuntu 15.04:
sudo systemctl restart apache2
In Ubuntu 14.10 and previous versions:
sudo service apache2 restart

 URL http:/localhost1  or http://localhost2
Credit

วันอังคารที่ 22 กันยายน พ.ศ. 2558

วันอาทิตย์ที่ 20 กันยายน พ.ศ. 2558

วันเสาร์ที่ 19 กันยายน พ.ศ. 2558

วันอังคารที่ 8 กันยายน พ.ศ. 2558

Manage SIte

a2ensite [site]

a2dissite [site]

 
sudo a2ensite example.com.conf
sudo a2ensite test.com.conf 
sudo service apache2 restart
 
 
sudo nano /etc/hosts
 
 
 
127.0.0.1   localhost
127.0.1.1   guest-desktop
111.111.111.111 example.com
111.111.111.111 test.com  
 
 
 
nano /etc/apache2/apache2.conf
 
below all
 
ServerName localhost  
 
sudo apt-get autoremove phpmyadmin 

Unlock

sudo chmod 777  /var/...
 
sudo chmod -R 777  /var/... 

sudo chown -R www-data: vendor...

sudo chmod -R 775 vendor...


วันจันทร์ที่ 7 กันยายน พ.ศ. 2558

Set Default apache2.conf

Set Default apache2.conf


<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

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

#<Directory /srv/>
#    Options Indexes FollowSymLinks
#    AllowOverride None
#    Require all granted
#</Directory>