发布时间:2020-04-12 19:26:39来源:阅读:
安装环境是阿里云ubuntu17.10,这个教程里我把域名都写成hostname.com, ip都写成192.168.1.1,你可以根据自己的需要更换。另外如果不是root账户的话,最好切换到root账户。
sudo su
我们使用apt-get方式安装MySQL:
apt-get -y install mysql-server mysql-client
安装的时候会要求你输入MySQL的root密码,建议此时输入,比较方便。
输入以下命令,让MySQL更安全:
mysql_secure_installation
我们将会被问这些问题:
root@root:~# mysql_secure_installationSecuring the MySQL server deployment.Enter password for user root: 这里输入MySQL密码VALIDATE PASSWORD PLUGIN can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD plugin?Press y|Y for Yes, any other key for No: 想要让MySQL验证密码强度可以填Y,但个人建议N。otherwise.Using existing password for root.Change the password for root ? ((Press y|Y for Yes, any other key for No) : 建议NoBy default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : 这个要填YSuccess.Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : 是否允许root远程登录?想要更安全选Y,但我建议选N,可以避免很多问题。Success.By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.Remove test database and access to it? (Press y|Y for Yes, any other key for No) : 这个选Y,移除没用的test表。- Dropping test database...Success.- Removing privileges on test database...Success.Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : 选YSuccess.All done!
MySQL就装好了。
apt-get install nginx
apt-get install nginx
然后你打开你的IP地址或域名,就能看见nginx默认页面了。
nginx默认的路径在/var/www/html
我们搭建wordpress博客主要要用到php-fpm组件,我们apt-get它,ubuntu会自动安装必要的php程序。
apt-get -y install php7.1-fpm
编辑nginx的默认站点配置文件
vim /etc/nginx/sites-available/default
server { listen 80 default_server; listen [::]:80 default_server; # SSL configuration # # listen 443 ssl default_server; # listen [::]:443 ssl default_server; # # Note: You should disable gzip for SSL traffic. # See: http://bugs.debian.org/773332 # # Read up on ssl_ciphers to ensure a secure configuration. # See: http://bugs.debian.org/765782 # # Self signed certs generated by the ssl-cert package # Don't use them in a production server! # # include snippets/snakeoil.conf;root /var/www/html;# Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html;server_name _;location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; }# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ { include snippets/fastcgi-php.conf; # With php7.0-cgi alone: fastcgi_pass 127.0.0.1:9000; # With php7.0-fpm: # fastcgi_pass unix:/run/php/php7.0-fpm.sock; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /.ht { deny all; }}
另外需要注意,我们是要安装wordpress的,所以又一个index的地方(# Add index.php to the list),在index后面要增加index.php
PHP-FPM默认是通过socket连接的,我们要改成用TCP链接。
vim /etc/php/7.0/fpm/pool.d/www.conf
修改listen:
;listen = /var/run/php5-fpm.sock
listen = 127.0.0.1:9000
像上面那样修改后,重启nginx:
service nginx restart
然后打开:
vim /etc/php/7.1/fpm/php.ini
设置cgi.fix_pathinfo=0
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting; of zero causes PHP to behave as before. Default is 1. You should fix your scripts; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.; http://php.net/cgi.fix-pathinfocgi.fix_pathinfo=0
reload php-fpm:
service php7.0-fpm reload
新建一个文件:
vim /var/www/html/info.php
写入
<?php
phpinfo();
?>
然后我们可以打开浏览器输入域名,例如 192.168.1.1/info.php(你的显示应该是php7.1)
你可以看到PHP已经工作了,包括现在支持的一些模块。
我们可以先看一下有哪些PHP7.1的模块:
apt-cache search php7.1
可以选一些你喜欢的模块安装(以下是我自己安装的):
apt-get -y install php7.1-mysql php7.1-gd php7.1-curl php7.1-intl php7.1-mcrypt
reload PHP-FPM:
service php7.1-fpm reload
刷新一下192.168.1.1/info.php,看一下自己的模块是否都安装好了。
这样就安装配置好了,接下来就可以在/var/www/html里上传wordpress文件了。
Nanosoft nanoCAD Pro (附安装教程) v8.5 破解版
565.46M
WampServer(php集成环境安装包)下载 v3.0.6中文
378.36 MB
pkpm2010破解版(建筑结构设计软件)附安装教程
1.56GB
AudFree Audio Capture
18.2M
EximiousSoft Screen Capture下载
9.7M
Screenshot Captor(屏幕截图工具) v4.36.2绿色免费版
9.6M
Webcam Capture下载
1.66M
360安全桌面 v2.8.0.1001 官方安装版
42.53M
IcoFX汉化破解版(附注册码+使用教程) v3.2.1
13.36M
UltraSnap Pro v4.0.2.0绿色汉化版 多种抓图方式+自定义快捷键抓图
13.68 MB
fastreport5破解版下载(附序列号+使用教程) V5.2.3
42.17M
usb3.0驱动(硬件驱动安装工具) v6.6 绿色版
8.67MB
刻绘大师V8破解版(免加密狗+使用教程) V8.20.1
388.97M
矮人DOS工具箱 V5.3 Bulid 6.713 安装版
9.01M
硬盘安装器下载
17.35 MB
3dsmax下载
3.82G
3d蓝光播放器下载
36.8 MB
Corel PhotoMirage下载
134M
Geany下载
15.1MB
HofoSetup下载
5.7M
2020-02-17
硬盘保护系统5.1在硬件配置一样,在网络同传后是否会出现找不到驱动的情况?
如何知道游戏是否兼容Windows 8系统
关于电池充电、保养、设置、较准的方法汇总
Thinkpad R50E 驱动下载及安装方法 for windows XP
VISTA、XP系统如何切换首选网卡(有线、无线同时连接网络时采用哪种方式上网)
微软Office官方卸载工具
ideapad S9E/S10E在XP系统下“一键恢复”按钮快捷键功能说明
联想天逸100/天逸200笔记本内置摄像头使用问题
安装Windows XP操作系统时,在复制完文件后重启时报磁盘分区错误