Ngnix
1 2 |
$ apt-get update $ apt-get install nginx |
安装完成之后测试一下
Ubuntu安装之后的文件结构大致为:
- 所有的配置文件都在/etc/nginx下,并且每个虚拟主机已经安排在了/etc/nginx/sites-available下
- 程序文件在/usr/sbin/nginx
- 日志放在了/var/log/nginx中
- 并已经在/etc/init.d/下创建了启动脚本nginx
- 默认的虚拟主机的目录设置在了/var/www/nginx-default (有的版本 默认的虚拟主机的目录设置在了/var/www, 请参考/etc/nginx/sites-available里的配置)
1 |
http://server_IP |
如果出现Welcome to ngnix,则安装成功
Mysql
1 |
$ apt-get install mysql-server |
安装完成之后,会发现无需密码也能直接访问,这个时候我们需要对他进行一定的设置。
1 2 3 4 5 |
use mysql; update user set authentication_string=PASSWORD("密码") where user='root'; update user set plugin="mysql_native_password"; flush privileges; exit;</code><code class=""> |
php
依次执行
1 2 3 4 5 |
apt-get update apt-get upgrade apt-get install -y software-properties-common apt-get install -y vim wget |
1 |
add-apt-repository ppa:ondrej/nginx |
1 |
add-apt-repository ppa:ondrej/php |
1 |
apt-get install -y php7.2 |
再安装各种模块
1 2 |
apt-get install -y php7.2-bcmath php7.2-bz2 php7.2-dba php7.2-enchant php7.2-fpm php7.2-imap php7.2-interbase php7.2-intl php7.2-mbstring php7.2-phpdbg php7.2-soap php7.2-sybase php7.2-xsl php7.2-zip php7.2-xmlrpc php7.2-xml php7.2-tidy php7.2-sqlite3 php7.2-snmp php7.2-recode php7.2-readline php7.2-pspell php7.2-pgsql php7.2-opcache php7.2-odbc php7.2-mysql |
1 |
apt-get install -y php7.2-ldap php7.2-json php7.2-gmp php7.2-gd php7.2-dev php7.2-curl php7.2-common php7.2-cli php7.2-cgi |
验证:分别执行下面两个语句,如果有提示表示安装成功
1 2 |
php7.2 -v php-fpm7.2 -v |
安装swoole
1 |
pecl install swoole |
1 |
find / -name swoole.so |
找链接地址
一般是
/usr/lib/php/20170718/swoole.so
则
1 |
echo "extension=swoole.so" >> /etc/php/7.2/cli/php.ini |
1 |
php7.2 -m|grep swoole |
如果swoole能看到,则说明安装成功。
1 |
vim /etc/php/7.2/fpm/pool.d/www.conf |
修改listen = /run/php/php7.2-fpm.sock
启动php-fpm
1 |
service php7.2-fpm start |
修改Nginx
1 |
vim /etc/nginx/sites-enabled/default |
修改
1 2 3 4 |
location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.2-fpm.sock; } |
启动
1 |
service nginx start |
修改php
在/etc/nginx/sites-available/default 中添加配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
server { listen 80; listen [::]:80; # listen [::]:443 ssl http2; # listen 443 ssl http2; # include ssl.conf; # ssl_certificate /path/to/crt; # ssl_certificate_key /path/to/key; root /home/wwwroot/xukeqin; //修改为网站根目录,这个文件夹事先创建好 index index.html index.htm index.php; //添加index.php<br /> client_max_body_size 8<span class="hljs-number">00</span>m; //设置最大上传大小 server_name server_domain_or_IP; //修改为网站根目录 location / { try_files $uri $uri/ =404; } location /phpmyadmin { index index.php; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; } location ~ /\.ht { deny all; } } |
重启
1 |
$ systemctl restart nginx |
安装FTP
1 |
sudo apt-get install vsftpd |
备份一下
1 |
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig |
修改
1 |
sudo vim /etc/vsftpd.config |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
local_enable=YES # # Uncomment this to enable any form of FTP write command. -#write_enable=YES +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 +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 @@ -67,11 +67,11 @@ # # You may override where the log file goes if you like. The default is shown # below. -#xferlog_file=/var/log/vsftpd.log +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 +xferlog_std_format=YES # # You may change the default value for timing out an idle session. #idle_session_timeout=600 @@ -100,7 +100,7 @@ #ascii_download_enable=YES # # You may fully customise the login banner string: -#ftpd_banner=Welcome to blah FTP service. +ftpd_banner=Welcome Lincoln Linux FTP Service. # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. @@ -120,9 +120,9 @@ # the user does not have write access to the top level directory within the # chroot) #chroot_local_user=YES -#chroot_list_enable=YES +chroot_list_enable=YES # (default follows) -#chroot_list_file=/etc/vsftpd.chroot_list +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 @@ -142,7 +142,7 @@ secure_chroot_dir=/var/run/vsftpd/empty # # This string is the name of the PAM service vsftpd will use. -pam_service_name=vsftpd +pam_service_name=ftp # # This option specifies the location of the RSA certificate to use for SSL # encrypted connections. @@ -152,4 +152,8 @@ # # Uncomment this to indicate that vsftpd use a utf8 filesystem. -#utf8_filesystem=YES +utf8_filesystem=YES +userlist_enable=YES +userlist_deny=NO +userlist_file=/etc/vsftpd.user_list +allow_writeable_chroot=YES |
上面+号表示添加,-号表示删去
与本博客之前配置FTP不同的是,在这儿我们配置多用户的
创建登录用户
1 2 3 4 5 6 7 8 9 |
#先创建ftp目录 $ sudo mkdir /home/wwwroot/xukeqin //创建FTP用户的默认文件夹,ps如果要指定已由的文件夹,可以不创建,跳过这一步 #添加用户 $ sudo useradd -d /home/wwwroot/xukeqin -s /bin/bash xukeqin //第一个参数为默认用户打开的根目录 #设置用户密码 $ sudo passwd xukeqin #设置ftp目录用户权限 $ sudo chown xukeqin:xukeqin /home/wwwroot/xukeqin //第一个参数为用户名 |
添加登录用户
1 2 3 |
#新建文件/etc/vsftpd.user_list,用于存放允许访问ftp的用户: $ sudo touch /etc/vsftpd.user_list $ sudo vim /etc/vsftpd.user_list |
打开后,在里面添加上用户名
添加用户名对目录树的权限
1 2 3 |
#新建文件/etc/vsftpd.chroot_list,设置可列出、切换目录的用户: $ sudo touch /etc/vsftpd.chroot_list $ sudo vim /etc/vsftpd.chroot_list |
同样在里面添加用户名
重启服务
1 |
sudo service vsftpd restart |
至此,我们完成了FTP的安装
phpMyAdmin
这个就很easy了,从官网上下载一个,利用ftp上传即可。