ubuntu下lamp配置
apache
在Ubuntu Linux上用
apt-get install apache2
安装Apache2后,竟然发现没有httpd.conf(位于/etc/apache2目录)
Ubuntu的Apache的配置文件是 /etc/apache2/apache2.conf
Web文档根目录默认在/var/www定义在
在 /etc/apache2/sites-enabled/000-default中
DocumentRoot /var/www/html
/etc/apache2/ports.conf,这里面设置了Apache使用的端口
说明:
/etc/apache2目录下
sites-available目录,放是真正的配置文件
ites- enabled目录存放的是指向这里的文件的符号链接
启动、重启、停止apache服务
sudo service apache2 start
sudo service apache2 restart
sudo service apache2 stop
创建VirtualHost
<VirtualHost 192.168.0.107:80> DocumentRoot /web/ ServerName 192.168.0.107:80 <Directory "/web/"> Options Indexes FollowSymLinks AllowOverride All Require all granted AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
启动Apache的Rewrite功能
sudo a2enmod rewrite
php
更新源列表,否则安装php会失败
vi /etc/apt/source.list
在最前面添加
deb http://mirrors.aliyun.com/ubuntu/ precise main restricteduniverse multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-security mainrestricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-updates mainrestricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-proposed mainrestricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-backports mainrestricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise mainrestricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-securitymain restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-updatesmain restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposedmain restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-backportsmain restricted universe multiverse
sudo apt-get update
安装PHP
sudo apt-get install php5
重启服务器
mysql
sudo apt-get install mysql-server
启动、重启、停止mysql服务
service mysql start
service mysql restart
service mysql stop
mysql 允许root远程登录
grant all privileges on *.* to root@"%" identified by "123456" with grant option;
修改配置文件/etc/mysql/my.cnf,把bind-address = 127.0.0.1注释掉
#bind-address = 127.0.0.1
查看本机ip地址
ifconfig -a
在winows下用Navicat,新建连接,能正常访问mysql
FTP
sudo apt-get install vsftpd
查看是否安装成功
sudo service vsftpd restart
建立ftp目录
sudo mkdir /home/ftpfile/ftpfile
新建ftp用户
sudo useradd –d /home/ftpfile –s /bin/bash baby
设置myftp用户密码
sudo passwd baby
修改ftp配置文件/etc/vsftpd.conf
anonymous_enable=NO local_enable=YES write_enable=YES chroot_local_user=YES chroot_list_enable=YES chroot_list_file=/etc/vsftpd.chroot_list
在/etc/目录中新建vsftpd.chroot_list文件
baby
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)