This article is mainly about the Web site program in the cloud server migration encountered problems, and the various cloud services to compare options.
Before using Laravel 5.1 developed a Community communication program, placed on Amazon's EC2 instance, is an aim Amazon's own built Linux server, must say Amazon service is first-class, there are few pits for you to tread, but since the discovery of Linode, Digitalocean, after Rackspace, compared the cost-effective, there is the idea of migration, after all, half the price. Linode.com compared to the history, and the package is 2G of memory, 24G SSD hard disk, 10 dollars One months what is more affordable than Amazon, as for digital Ocean's cheapest option is 5 dollars one months, but only 512 memory, a little bit of program will explode, So choose Linode, the speed and the Amazon ratio is not too slow. As for the other try nitrous.com, all the same.
But the most popular cloud service providers are Ubuntu Linux 14.X and 16. X, Ubuntu itself generally comes with a PHP version that is 7.0,apache version is 2.4.9
I chose Ubuntu Linux 14.X
To install the following software:
Apache2.4.16, but this is not the same as Ubuntu, its home installation package does not have this packages, can only be installed Apache2.4.9
Composer 1.0-dev (2015-10-13)
First of all, the configuration of PHP, to use laravel, it is necessary to have some modules, which in https://laravel.com/docs/5.3 here to understand, do not doubt, there will be no error.
- PHP >= 5.6.4 (i installed the Laravel5.1, so can also use PHP5.5.9)
- OpenSSL PHP Extension
- PDO PHP Extension
- Mbstring PHP Extension
- Tokenizer PHP Extension
- Mcrypt PHP Extension I added this one.
PDO is connected to the database, I use the SQLite, so also to install
sudo apt-get install Php5-sqlite,
With the MySQL classmate to install
sudo apt-get install Php5-mysql,
After the GIT clone program address, change the directory name to the path name you configured in Apache, such as Huiqiao,
Here to change the directory and directory files into a apache2 group, you can write:
sudo chown–r www-data:www-data Huiqiao
Also give two two level subdirectory 775 permissions, you can write:
sudo chmod–r 775 huiqiao/storage huiqiao/bootstrap
Here to brush the browser, or there is a problem, does not appear the page, so:
sudo rm composer.lock
sudo composer update
Visit the site appeared home, but click on the page, found that the path does not work, here wasted a lot of time, because I do not know the role of rewrite, think the database is bad, re-migrate:refresh the database, not to change MySQL once again, or not. Finally found that the Mod_rewrite module is not enabled, this is the problem of apache2, not the problem of PHP, has not found the focus. Because there is a. htaccess file in the public directory of Laravel, the function is a path rewrite. The methods that are enabled in different Linux may not be the same in Debian and Ubuntu:
Su a2enmod rewrite (this command is the meaning of apache2 enable module)
SU Service apache2 restart
The solution to these problems can be relied upon to write a/var/www/html/under the
echo "<?php phpinfo ();" >index.php probe, and then you can see which modules are active in apache,php, and you can see the Apache2 user group
The above is Linode, the following is the Amazon, too full.
Money will not toss, hehe.
Site Cloud server encounters a pit when migrating