linux 服务器部署 lnamp 二apache安装
2017-08-22 09:24
513 查看
一、yum安装
yum -y
install
httpd二、编译安装官方教程:http://httpd.apache.org/docs/2.4/install.html1.下载
wget http://apache.fayea.com//httpd/httpd-2.4.27.tar.gz tar xvzf httpd-2.4.25.tar.gz cd httpd-2.4.252../configure报错
checking for APR... no configure: error: APR not found. Please read the documentation. 需要安装三个依赖库:pcre,apr,apr-util
3.安装pcre perl的正则库
wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz tar xvzf pcre-8.40.tar.gz cd pcre-8.40 ./configure --prefix=/usr/local/pcre make make install 如果报错:configure: error: You need a C++ compiler for C++ support. 还需要安装gcc –c++ yum install -y gcc gcc-c++
4.安装apr/apr-util有两种方式:
a:各自编译,然后http编译时参数适用 wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.5.2.tar.gz tar xvzf apr-1.5.2.tar.gz cd apr-1.5.2 ./configure –prefix=/usr/local/apr 报错:rm: cannot remove 'libtoolT': No such file or directory vim configure文件,查找30206行, $RM "$cfgfile" 这个地方,用#注释掉 继续./configure –prefix=/usr/local make make install wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.5.4.tar.gz tar xzvf apr-util-1.5.4.tar.gz cd apr-util-1.5.4 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config make make install 对应http编译配置 ./configure --prefix=/lnamp/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre make make install
b.将代码拷贝至http源码目录 wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz tar xvzf apr-1.5.2.tar.gz mv apr-1.5.2 apr wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz tar xzvf apr-util-1.5.4.tar.gz mv apr-util-1.5.4 apr-util mv apr apr-util /lnamp/src/httpd-2.4.25/srclib/
5.编译(使用将apr和apr-util拷至Apache内部方法,
–-with-included-apr,是指使用上面b方法)
./configure –-prefix=/lnamp/apache2 –-with-pcre=/usr/local/pcre/bin/pcre-config –-with-included-apr make make install
报错: xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory #include <expat.h> ^ compilation terminated. make[3]: *** [xml/apr_xml.lo] Error 1 make[3]: Leaving directory `/opt/src/httpd-2.4.27/srclib/apr-util' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/opt/src/httpd-2.4.27/srclib/apr-util' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/opt/src/httpd-2.4.27/srclib' make: *** [all-recursive] Error 1
yum install expat-devel
6.启动apache/lnamp/apache2/bin/apachectl -f /lnamp/apache2/conf/httpd.conf可能需要修改http.conf将里面的 #ServerName localhost:80 注释去掉即可。
成功提示 httpd (pid ***) already running停止apache/lnamp/apache2/bin/apachectl –k stop
7.配置文件1.支持php http.conf添加 AddType application/x-httpd-php .php2.添加重写 mod_rewrite去掉注释3.http.conf最后添加 Include /www/vhosts/*.conf8.网站conf文件简单编写
<VirtualHost *:80>ServerName poetnote.comDocumentRoot "/var/www/poetnote/public"SetEnv APPLICATION_ENV "development"<Directory "/var/www/poetnote/public">DirectoryIndex index.phpAllowOverride AllRequire all granted</Directory></VirtualHost>9.网站conf文件,python,django使用
<VirtualHost *:80>
ServerName sports.poetnote.com#ServerAlias otherdomain.comServerAdmin ghoiufyia@163.comAlias /media/ /var/www/sports/media/Alias /static/ /var/www/sports/static/<Directory /var/www/sports/media/>Require all granted</Directory><Directory /var/www/sports/static/>Require all granted</Directory>WSGIScriptAlias / /var/www/sports/sports/wsgi.py# WSGIDaemonProcess ziqiangxuetang.com python-path=/home/tu/blog:/home/tu/.virtualenvs/blog/lib/python2.7/site-packages# WSGIProcessGroup ziqiangxuetang.com<Directory /var/www/sports/sports/><Files wsgi.py/>Require all granted</Files></Directory></VirtualHost>
成功提示 httpd (pid ***) already running停止apache/lnamp/apache2/bin/apachectl –k stop
相关文章推荐
- PHP web服务器终极解决方案:CentOS v6.x Minimal 32bit + LNAMP 一键安装包【Linux+Nginx+Apache+MySQL+PHP+phpMyAdmin】
- linux 服务器部署 lnamp 三、php安装
- Linux下安装Tomcat服务器和部署Web应用
- Linux安装Apache服务器tomcat启动后无法访问解决方法
- Linux下安装Apache并以mod_wsgi方式部署django站点
- linux 服务器安装svn 及 自动更新部署
- Linux上安装apache-tomcat-8.5.15服务器
- Tomcat服务器的安装与部署(linux系统)
- web服务器 linux+apache+tomcat+mysql+jsp+php 整合安装
- 如何在Linux下部署web程序(搭建vsftp服务,搭建sshd 服务器,jdk安装步骤,Tomcat安装步骤,MySQL安装步骤)
- linux下部署PostgreSQL_yum安装_DNS服务器的问题
- Linux上安装Apache,oralce,cognos服务器操作步骤以及注意事项
- linux安装部署apache+subversion+jsvnadmin
- 在Linux中安装部署tomcat服务器
- 腾讯云服务器linux系统下apache php mysql安装
- 从写项目到部署linux服务器全过程-linux下tomcat的安装篇
- linux下安装apache服务器
- Ubuntu Server 14.04 安装+安全Web服务器(linux+apache+mysql+php)搭建流程(更新)
- LINUX系统下apache+svn服务器安装配置全过程
- Linux安装Apache服务器