1 下载安装lnmp

1.1 下载及解压lnmp

wget http://soft.vpser.net/lnmp/lnmp1.6.tar.gz -cO lnmp1.6.tar.gz && tar zxf lnmp1.6.tar.gz && cd lnmp1.6

1.2 修改php配置

修改lnmp.conf

Enable_PHP_Fileinfo = 'y'

1.3 使用Screen安装lamp

screen -S lnmp
 ./install.sh lamp

窗口状态下可以先按Ctrl-A,然后按d返回主窗口状态 主窗口状态下输入screen -r lnmp 可以恢复到lnmp窗口

1.4 apache的配置

httpd 配置文件是/usr/local/apache/conf/httpd.conf vhost文件夹是/usr/local/apache/conf/vhost 若网站需要反代理服务器,可以在相应配置文件中加入以下文本

ProxyPass /toutiao http://localhost:8080/toutiao
ProxyPassReverse /toutiao http://localhost:8080/toutiao
<div class="highlight"><pre><span></span>ssl文件配置
</pre></div>

<VirtualHost www.domain.com:443>
    DocumentRoot "/var/www/html"
    ServerName www.domain.com
    SSLEngine on
    SSLCertificateFile 2_www.domain.com_cert.crt
    SSLCertificateKeyFile 3_www.domain.com.key
    SSLCertificateChainFile 1_root_bundle.crt
</VirtualHost>
<div class="highlight"><pre><span></span>## 2 安装ftp服务器
在lnmp文件夹下输入命令安装Pureftpd
</pre></div>
aidl
./pureftpd.sh
<div class="highlight"><pre><span></span>安装好后,输入lnmp ftp管理ftp帐号
## 3 安装nginx
在lnmp文件夹下输入命令安装nginx
</pre></div>
aidl
yum -y install nginx
<div class="highlight"><pre><span></span>nginx配置文件是`/etc/nginx/nginx.conf`
若网站需要反代理服务器,可以在相应配置文件中加入以下文本
</pre></div>
 bash
upstream tomcatserver1 {
    server 127.0.0.1:8080;
}
location /toutiao {
    proxy_pass   http://tomcatserver1/toutiao;
    index  index.html index.htm;
}
<div class="highlight"><pre><span></span>注意:
lnmp中配置文件位置是`/usr/local/nginx/conf/nginx.conf`
启动命令是
</pre></div>

/etc/init.d/nginx restart
<div class="highlight"><pre><span></span>## 4 安装tomcat
安装jdk和tomcat
</pre></div>
aidl
yum install -y java tomcat tomcat-webapps tomcat-admin-webapps 
systemctl restart tomcat 
systemctl enable tomcat 
<div class="highlight"><pre><span></span>tomcat的应用文件夹是`/var/lib/tomcat`
tomcat 网页文件夹是`/usr/share/tomcat/webapps`

### 5 更新yum源
更新yum源为阿里源
</pre></div>
aidl
cd /etc/yum.repos.d/
wget http://mirrors.aliyun.com/repo/Centos-7.repo
mv CentOS-Base.repo CentOs-Base.repo.bak
mv Centos-7.repo CentOS-Base.repo
yum clean all
yum makecache
yum update