Failed to install sqlite3:
apt-get install libsqlite3-dev
CREATE DATABASE name CHARACTER SET utf8 COLLATE utf8_general_ci; CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON database.* TO 'user'@'localhost'; flush privileges;
#
# host.com
#
server {
listen 80;
server_name www.host.com;
rewrite ^ $scheme://host.com$request_uri? permanent;
}
server {
listen 80;
server_name host.com;
access_log /var/www/logs/host.com.access.log;
error_log /var/www/logs/host.com.error.log;
root /var/www/host.com/web;
index app.php; #for production frontend
location / {
try_files $uri $uri/ /app.php?$args;
}
location = /favicon.ico {
#log_not_found off;
access_log off;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
location ~ /\.ht {
deny all;
}
location ~ \.php($|/) {
try_files $uri =404;
include fastcgi_params;
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+\.php)($|/)") {
set $script $1;
}
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param PATH_INFO $path_info;
}
Origin: https://gist.github.com/879378
# apt-get install mysql-client libmysqlclient-dev
test.example.com test2.example.comGo to your's DNS config panel and add 2 CNAME records with ec2 instance address ( same for both)
ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.comlogin to aws.
yum install nginxsee version (for future troubleshooting, if it ocuur)
nginx -vCreate 2 vhosts folder tructures.
cd /var/ mkdir www cd www/Folder for each vhost
mkdir test.example.com mkdir test2.example.com cd test.example.com/ mkdir logs mkdir web mcedit web/index.htmlCreate simple html page:
<html> <body>test.example.com</body> </html>
cd .. cd test2.example.com/ mkdir logs mkdir web mcedit web/index.htmlContent for vhost 2
<html> <body>test2.example.com</body> </html>Change web root owner
chown -R nginx:nginx /var/www
cd /etc/nginx/conf.d/ mcedit virtual.confAdd this lines to virtual.conf:
index index.htm index.html index.php;
#
# test.example.com
#
server {
listen 80;
server_name www.example.com;
rewrite ^ $scheme://test.example.com$request_uri? permanent;
}
server {
listen 80;
server_name test.example.com;
access_log /var/www/test.example.com/logs/access.log;
error_log /var/www/test.example.com/logs/error.log;
root /var/www/test.example.com/web;
}
#
# test2.example.com
#
server {
listen 80;
server_name www.test2.example.com;
rewrite ^ $scheme://test2.example.com$request_uri? permanent;
}
server {
listen 80;
server_name test2.example.com;
access_log /var/www/test2.example.com/logs/access.log;
error_log /var/www/test2.example.com/logs/error.log;
root /var/www/test2.example.com/web;
}
Restart nginx:service nginx restartOpen in browser http://test.example.com and test2.example.com . Each page has different content.