网络运营 > 服务器 > Linux

Ubuntu16.04搭建php5.6Web服务器环境

51人参与2019-07-19

ubuntu 16.04默认安装php7.0环境,但是php7目前对某些旧系统的兼容性并不是很好,如果自行安装php5需要清除php7的已安装包,否则会报错。

移除默认及已安装的php包

sudo dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
sudo apt-get install aptitude
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

添加 ppa

sudo add-apt-repository ppa:ondrej/php

安装php5.6

sudo apt-get update
sudo apt-get install php5.6

安装扩展

sudo apt-get install php5.6-gd
sudo apt-get install php5.6-mysql

安装apache2

sudo apt install apache2
sudo apt-get install libapache2-mod-php5.6

安装mysql

sudo apt install mysql-server php5.6-mysql  root root0x0
sudo apt-get install mysql-client
mysql_secure_installation

安装 phpmyadmin

sudo apt-get install phpmyadmin
sudo apt-get install php5.6-mbstring
sudo apt-get install php5.6-gettext
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

配置phpmyadmin

nano /etc/php/5.6/apache2/php.ini
display_errors = on(显示错误日志,出现两次,都要改,不然无效)
extension=php_mbstring.dll (开启mbstring)
sudo dpkg-reconfigure phpmyadmin (重新配置phpmyadmin)

增加网站

sudo ln -s /etc/apache2/sites-available/files.conf /etc/apache2/sites-enabled/files.conf
sudo chown -r www-data /var/www/tianya
sudo /etc/init.d/apache2 restart

添加ftp

sudo apt install vsftpd
useradd -d /var/www/tianya -s /sbin/nologin myftp
passwd myftp
chmod 777 -r /var/www/tianya
usermod -s /sbin/nologin myftp
vim /etc/vsftpd.conf
vim /etc/vsftpd.chroot_list
service vsftpd restart
service vsftpd status
# example config file /etc/vsftpd.conf
#
# the default compiled in settings are fairly paranoid. this sample file
# loosens things up a bit, to make the ftp daemon more usable.
# please see vsftpd.conf.5 for all compiled in defaults.
#
# read this: this example file is not an exhaustive list of vsftpd options.
# please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# run standalone? vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
#userlist_enable=yes
#userlist_deny=no
#userlist_file=/etc/vsftpd.user_list
listen=yes
#
# run standalone with ipv6?
# like the listen parameter, except vsftpd will listen on an ipv6 socket
# instead of an ipv4 one. this parameter and the listen parameter are mutually
# exclusive.
#listen_ipv6=yes
#
# allow anonymous ftp? (disabled by default)
anonymous_enable=no
#
# uncomment this to allow local users to log in.
local_enable=yes
#
# uncomment this to enable any form of ftp write command.
write_enable=yes
#
# default umask for local users is 077. you may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# uncomment this to allow the anonymous ftp user to upload files. this only
# has an effect if the above global write enable is activated. also, you will
# obviously need to create a directory writable by the ftp user.
#anon_upload_enable=yes
#
# uncomment this if you want the anonymous ftp user to be able to create
# new directories.
#anon_mkdir_write_enable=yes
#
# activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=yes
#
# if enabled, vsftpd will display directory listings with the time
# in your local time zone. the default is to display gmt. the
# times returned by the mdtm ftp command are also affected by this
# option.
use_localtime=yes
#
# activate logging of uploads/downloads.
xferlog_enable=yes
#
# make sure port transfer connections originate from port 20 (ftp-data).
connect_from_port_20=yes
#
# if you want, you can arrange for uploaded anonymous files to be owned by
# a different user. note! using "root" for uploaded files is not
# recommended!
#chown_uploads=yes
#chown_username=whoever
#
# you may override where the log file goes if you like. the default is shown
# below.
xferlog_file=/var/log/vsftpd.log
#
# if you want, you can have your log file in standard ftpd xferlog format.
# note that the default log file location is /var/log/xferlog in this case.
xferlog_std_format=yes
#
# you may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# you may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# it is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# enable this and the server will recognise asynchronous abor requests. not
# recommended for security (the code is non-trivial). not enabling it,
# however, may confuse older ftp clients.
#async_abor_enable=yes
#
# by default the server will pretend to allow ascii mode but in fact ignore
# the request. turn on the below options to have the server actually do ascii
# mangling on files when in ascii mode.
# beware that on some ftp servers, ascii support allows a denial of service
# attack (dos) via the command "size /big/file" in ascii mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ascii mangling is a horrible feature of the protocol.
#ascii_upload_enable=yes
#ascii_download_enable=yes
#
# you may fully customise the login banner string:
ftpd_banner=welcome to blah ftp service.
#
# you may specify a file of disallowed anonymous e-mail addresses. apparently
# useful for combatting certain dos attacks.
#deny_email_enable=yes
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# you may restrict local users to their home directories. see the faq for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
#chroot_local_user=yes
#
# you may specify an explicit list of local users to chroot() to their home
# directory. if chroot_local_user is yes, then this list becomes a list of
# users to not chroot().
# (warning! chroot'ing can be very dangerous. if using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
chroot_local_user=yes
chroot_list_enable=yes
# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list
#
# you may activate the "-r" option to the builtin ls. this is disabled by
# default to avoid remote users being able to cause excessive i/o on large
# sites. however, some broken ftp clients such as "ncftp" and "mirror" assume
# the presence of the "-r" option, so there is a strong case for enabling it.
#ls_recurse_enable=yes
#
# customization
#
# some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# this option should be the name of a directory which is empty. also, the
# directory should not be writable by the ftp user. this directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# this string is the name of the pam service vsftpd will use.
pam_service_name=vsftpd
#
# this option specifies the location of the rsa certificate to use for ssl
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
# this option specifies the location of the rsa key to use for ssl
# encrypted connections.
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对萬仟网的支持。如果你想了解更多相关内容请查看下面相关链接

您希望与广大热心网友互动!!点此进行留言回复

相关推荐

Ubuntu16.04搭建php5.6Web服务器环境

07-19

Linux系统查看CPU、机器型号、内存等信息

07-19

Linux系统中掩耳盗铃的sudo配置

08-09

阿里云Linux主机安装WDCP管理面板(包含lamp+lnmp+lanmp环境)

05-31

使用top命令分析linux系统性能的详解

07-19

增强Linux和Unix服务器安全性的方法详解

07-19

干货 | Linux新手入门好书推荐

05-31

Linux内核设备驱动之内核的调试技术笔记整理

04-17

CentOs 7.*中配置安装phpMyAdmin的完整步骤记录

05-05

Linux操作系统与命令知识汇总

06-04

最近更新

Ubuntu16.04搭建php5.6Web服务器环境

07-19

在Bash脚本中创建和使用数组方法总结

07-19

Linux上通过SSH挂载远程文件系统方法详解

07-19

bash脚本中将密码传递给ssh/scp命令方法详解

07-19

Linux中使用命令more,less,cat查看文件内容

07-19

Linux中chown与chmod两个命令的区别详解

07-19

增强Linux和Unix服务器安全性的方法详解

07-19

使用top命令分析linux系统性能的详解

07-19

Linux系统查看CPU、机器型号、内存等信息

07-19

在Linux中如何查看可用的网络接口详解

07-19

网友评论

已有0条评论