25 November 2014

linux vps

软连接

cd /var/www/w3cmm.com/public_html
ln -s /usr/share/phpmyadmin

主机名

echo "thunk" > /etc/hostname
hostname -F /etc/hostname

hots

127.0.0.1 localhost.localdomain localhost 
104.237.157.37 w3cmm.com thunk

创建常用目录

sudo mkdir -p w3cmm.com/public_html
sudo mkdir -p w3cmm.com/log
sudo mkdir -p w3cmm.com/backups

创建服务

nano /etc/apache2/sites-available/w3cmm.com.conf

域名及目录

# domain: w3cmm.com
# public: /var/www/w3cmm.com/public_html/

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin stormte@gmail.com
  ServerName  w3cmm.com
  ServerAlias w3cmm.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/w3cmm.com/public_html
  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/w3cmm.com/log/error.log
  CustomLog /var/www/w3cmm.com/log/access.log combined
</VirtualHost>

开启

sudo a2ensite w3cmm.com.conf

重启

/etc/apache2/apache2.conf

创建数据库

create database w3cmm;
grant all on w3cmm.* to 'stormtea' identified by '19100biao'; 
flush privileges;

打开rewrite

a2enmod rewrite
mod mime

wordpress目录权限

cd /var/www
sudo chgrp -R www-data *
cd w3cmm.com/public_html/wp-content
sudo chmod -R 755 uploads/


# Make sure Apache2 is looking for .HTACCESS files
<Files ~ "^\.ht">
Order allow,deny
Deny from all
</Files>


# Make sure Apache allows AllowOverride (so .HTACCESS is parsed)
<Directory /var/www>
AllowOverride All
Options FollowSymLinks
</Directory>

enable mod_headers

sudo a2enmod headers

重启

sudo /etc/init.d/apache2 restart
service apache2 reload


# domain: bee.w3cmm.com
# public: /var/www/bee.w3cmm.com/public_html/

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin stormte@gmail.com
  ServerName  bee.w3cmm.com
  #ServerAlias bee.w3cmm.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /var/www/bee.w3cmm.com/public_html
  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/bee.w3cmm.com/log/error.log
  CustomLog /var/www/bee.w3cmm.com/log/access.log combined
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin stormte@gmail.com
    ServerName  bee.w3cmm.com
    #ServerAlias bee.w3cmm.com
    
    <Proxy *>
      Allow from all
    </Proxy>
    <Location />
      ProxyPass http://location:3000/
    </Location>
</VirtualHost>