“Every sale has five basic obstacles: no need, no money, no hurry, no desire, no trust.” - zig ziglar
“BUT WHO PRAYS FOR SATAN? WHO, IN EIGHTEEN CENTURIES, HAS HAD THE COMMON HUMANITY TO PRAY FOR THE ONE SINNER THAT NEEDED IT MOST?” MARK TWAIN
http://blog.logos.com/2013/05/10-more-warren-wiersbe-quotes/ - Warren Wiersbe - Religion!!!
Courage is resistance to fear, mastery of fear, not absence of fear. Mark Twain
Lê e sente, algumas aulas de escrita e diálogo de línguas latinas, notícias estonteantes e é claro o meu Blog.
Um abraço e apreciem o momento.
Sunday, February 09, 2014
Saturday, February 08, 2014
Linux LAMP - Virtual Hosts Configuration
Hello Linuxers this article may be helpful to set-up virtual hosts on a Linux Box.
The purpose of Virtual-hosts is to use different domains or multiple websites being served/hosted from one single web-server e.g. Apache2 and also organize them by directory, this can be done via name-based or IP-based virtual hosts.
In this case I use name-based website on a single ip address.
For example we need one directory on the document root for all files don't mix up in the same folder, so that each host has its own directory to avoid confusion.
Our goal is to make a new host called site1.com - we wish to put all files at /var/www/site1/ and access it via http://www.site1.com or http://site1.com
We know the Document Root is in /var/www/ that is explicit defined in /etc/apache2/sites-enabled/default
Here are the commands to make a virtual-host just repeat to create new ones.
6.To finish we also need some ip-hostname entry to /etc/hosts to recognize this domain, I call it domain aliased to ip-address because we set *:80 in the config file.
On the sites-available/site1 file as you see are important directives like ServerName, ServerAlias and DocumentRoot which give unique identity to the virtual-host.
/etc/php5/ - php5 configuration file is php.ini
/etc/phpmyadmin/ - phpmyadmin directory
/etc/apache2/ - apache2.conf configuration file
/etc/mysql - my.cnf mysql configuration file
# respective *-available/ counterparts. These should be managed by using our
# helpers a2enmod/a2dismod, a2ensite/a2dissite. See
# their respective man pages for detailed information.
# enable site
# disable an apache2 module
# useful links for virtual-host information
http://httpd.apache.org/docs/2.2/vhosts/
http://httpd.apache.org/docs/2.2/vhosts/name-based.html
http://httpd.apache.org/docs/2.2/vhosts/examples.html
http://www.centos.org/docs/2/rhl-rg-en-7.2/s1-apache-config.html
The purpose of Virtual-hosts is to use different domains or multiple websites being served/hosted from one single web-server e.g. Apache2 and also organize them by directory, this can be done via name-based or IP-based virtual hosts.
In this case I use name-based website on a single ip address.
For example we need one directory on the document root for all files don't mix up in the same folder, so that each host has its own directory to avoid confusion.
Our goal is to make a new host called site1.com - we wish to put all files at /var/www/site1/ and access it via http://www.site1.com or http://site1.com
We know the Document Root is in /var/www/ that is explicit defined in /etc/apache2/sites-enabled/default
Here are the commands to make a virtual-host just repeat to create new ones.
Virtual-host set-up configuration
sudo mkdir -p /var/www/site1/public_html
sudo chown -R $USER:$USER /var/www/site1/public_html
sudo chmod -R 755 /var/www/
sudo nano /var/www/site1/public_html/index.html
1.Inside index.html put this small text, use echo or edit file with nano:sudo chown -R $USER:$USER /var/www/site1/public_html
sudo chmod -R 755 /var/www/
sudo nano /var/www/site1/public_html/index.html
<html>
<head>
<title>www.site1.com</title>
</head>
<body>
<h1>
Success: You Have Set Up a Virtual Host</h1>
</body>
</html>
2.Now we create and add the real virtual-host and directory information entry to Apache2 configuration:<head>
<title>www.site1.com</title>
</head>
<body>
<h1>
Success: You Have Set Up a Virtual Host</h1>
</body>
</html>
sudo nano /etc/apache2/sites-available/site1
3.inside the file write:<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName site1.com
ServerAlias www.site1.com
DocumentRoot /var/www/site1/public_html
<Directory /var/www/site1/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error_site1
LogLevel warn
CustomLog /var/log/apache2/access_site1 combined
ServerSignature Off
</VirtualHost>
4.now we enable this site using a2ensite utility and reload Apache configuration:ServerAdmin webmaster@example.com
ServerName site1.com
ServerAlias www.site1.com
DocumentRoot /var/www/site1/public_html
<Directory /var/www/site1/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error_site1
LogLevel warn
CustomLog /var/log/apache2/access_site1 combined
ServerSignature Off
</VirtualHost>
sudo a2ensite site1
sudo service apache2 reload
5.To review we created the directory for the website, we gave permissions to the directory, we created a simple index.html, and created virtual-host configuration file and enabled it with a2ensite.sudo service apache2 reload
6.To finish we also need some ip-hostname entry to /etc/hosts to recognize this domain, I call it domain aliased to ip-address because we set *:80 in the config file.
On the sites-available/site1 file as you see are important directives like ServerName, ServerAlias and DocumentRoot which give unique identity to the virtual-host.
nano /etc/hosts
7.Edit the file and add an entry at the last line of the file:127.0.0.1 site1.com www.site1.com
Useful configuration files location:
/etc/hosts - hosts file to define hostname ips and aliases/etc/php5/ - php5 configuration file is php.ini
/etc/phpmyadmin/ - phpmyadmin directory
/etc/apache2/ - apache2.conf configuration file
/etc/mysql - my.cnf mysql configuration file
Helpers to enable or disable virtual-hosts, modules
#They are activated by symlinking available configuration files from their# respective *-available/ counterparts. These should be managed by using our
# helpers a2enmod/a2dismod, a2ensite/a2dissite. See
# their respective man pages for detailed information.
# enable site
sudo a2ensite
# disable sitesudo a2dissite
# enable an apache2 modulesudo a2enmod
# e.g. a2enmod php4 will create the correct symlinks in mods-enabled to allow the module to be used. In this example it will link both php4.conf and php4.load for the user# disable an apache2 module
sudo a2dismod
# force reload the server configurationsudo service apache2 reload
# useful links for virtual-host information
http://httpd.apache.org/docs/2.2/vhosts/
http://httpd.apache.org/docs/2.2/vhosts/name-based.html
http://httpd.apache.org/docs/2.2/vhosts/examples.html
http://www.centos.org/docs/2/rhl-rg-en-7.2/s1-apache-config.html
Linux LAMP (Linux, Apache, MySQL, PHP)
Install Apache
sudo apt-get install apache2
Testing Apache
http://localhost/
Install PHP
sudo apt-get install php5 libapache2-mod-php5
Step: Eventually you need to:
sudo /etc/init.d/apache2 restart
Test PHP
Step: Let's test if PHP is working correctly.
sudo nano /var/www/index.php
or...sudo echo “<?php phpinfo(); ?>” > /var/www/index.php
Step 3. Save and close the file.
Step 4. Now open you're web browser and type the following into the web address:
http://localhost/index.php
(It will show you the page that has all information about your php. If you have prior experience of installing php in some other OS, you must have seen this page.)
Congrats you have now installed both Apache and PHP!
Install MySQL
To finish this guide up we will install MySQL.
Step 1. Once again open up the amazing Terminal and then copy/paste or type this line:
sudo apt-get install mysql-server
Step 2 (optional). In order for other computers on your network to view the server you have created, you must first edit the "Bind Address". Begin by opening up Terminal to edit the my.cnf file.
sudo nano /etc/mysql/my.cnf
Change the linebind-address = 127.0.0.1
And change the 127.0.0.1 to your IP address.
(In Linux Mint 11, terminal itself asked to the set password, But if it doesn't follow the step 3.)
Step 3. This is where things may start to get tricky. Begin by typing the following into Terminal:
mysql -u root
Following that copy/paste or type this line:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
(Make sure to change yourpassword to a password of your choice.)
Step 4. We are now going to install a program called phpMyAdmin which is an easy tool to edit your databases. Copy/paste or type the following line into Terminal:
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
After that is installed our next task is to get PHP to work with MySQL. To do this we will need to open a file entitled php.ini. To open it type the following:
sudo nano /etc/php5/apache2/php.ini
Now we are going to have to uncomment the following line by taking out the semicolon ";"Change this line:
;extension=mysql.so
To look like this:extension=mysql.so
Now just restart Apache and you are all set! sudo /etc/init.d/apache2 restart
PhpMyAdmin Configuration
If you get a 404 error upon visiting http://localhost/phpmyadmin: You will need to configure apache2.conf to work with Phpmyadmin.sudo nano /etc/apache2/apache2.conf
Include the following line at the bottom of the file, save and quit.Include /etc/phpmyadmin/apache.conf
Installing LAMP on Linux Mint
1. Install Apache2 on Linux Mint using apt-get.sudo apt-get install apache2
sudo apt-get install phpmyadmin
sudo apt-get install mysql-server
2. Install PHP and the various modules enabling Apache to work with PHP using apt-get.
sudo apt-get install php5 libapache2-mod-php5
sudo apt-get install libapache2-mod-auth-mysql php5-mysql
3. Install MySQL Server and set root MySQL user password with the following command, it will automatically prompt you for the password during installation.
4. Create a quick php test script that uses the phpinfo() function to test your server with. After running this command simply open up Firefox or Chrome and go to http://127.0.0.1/index.php or http://localhost/index.php.
sudo echo “<?php phpinfo(); ?>” > /var/www/index.php
5. Reload Apache2 Configuration
service apache2 reload
Monday, February 03, 2014
Poesia 2014 - Fernando Pessoa
Ó mar salgado, quanto do teu sal
São lágrimas de Portugal!
Por te cruzarmos, quantas mães choraram,
Quantos filhos em vão rezaram!
Quantas noivas ficaram por casar
Para que fosses nosso, ó mar!
Valeu a pena? Tudo vale a pena
Se a alma não é pequena.
Quem quer passar além do Bojador
Tem que passar além da dor.
Deus ao mar o perigo e o abismo deu,
Mas nele é que espelhou o céu.
Fernando Pessoa Pessoa, F. Mensagem. Poema X Mar Português. Edições Ática: Lisboa. 1959.
Subscribe to:
Posts (Atom)