安装网站服务器:
1.安装nginx:http://my.oschina.net/duwaiweb/blog/80578
apt-get install nginx
/etc/init.d/nginx start
配置域名:http://wiki.ubuntu.org.cn/Vps
nginx默认用户名和用户组:www-data:www-data
2.安装PHP-FPM:
#
# deb cdrom:[Debian GNU/Linux 8.5.0 _Jessie_ - Official amd64 DVD Binary-1 20160604-15:35]/ jessie contrib main
deb http://mirrors.ustc.edu.cn/debian/ jessie main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian/ jessie main contrib non-free
deb http://mirrors.ustc.edu.cn/debian/ jessie-updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian/ jessie-updates main contrib non-free
deb http://mirrors.ustc.edu.cn/debian/ jessie-backports main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian/ jessie-backports main contrib non-free
deb http://mirrors.ustc.edu.cn/debian-security/ jessie/updates main contrib non-free
deb-src http://mirrors.ustc.edu.cn/debian-security/ jessie/updates main contrib non-free
apt-get install php5-cgi php5-fpm php5-gd php5-mysql php5-curl php5-mcrypt php5-common php-apc
apt-get install php5-mysqlnd php5-readline
##然后安装了mysql 和 phpmyadmin
/etc/nginx/sites-enabled里面的example.com中,修改php那段为:
index index.html index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
修改/etc/nginx/fastcgi_params文件,在文件最后添加
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
重启nginx和php5-fpm
<?php phpinfo(); ?>
APC 可显著加速 PHP 应用的速度。在应用中加入 APC 可提升应用的响应速度,降低服务器负载。
apt-get install php-apc
/etc/init.d/php5-fpm restart
/etc/init.d/nginx restart
#location ~ \.php$ {
location ~ \.php($|/) {
3.安装mysql:
apt-get install mysql-server
nano /etc/mysql/my.cnf
[client]下添加default-character-set=utf8
修改root密码:
# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> update user set password=password('fjvnriQ!1') where user='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysql restart
# mysql -uroot -p
安装phpmyadmin
注意不要再按空格选择 apache2 , 直接回车下一步。
cd /var/www/html
ln -s /usr/share/phpmyadmin .
以上 debian8架设nginx+php+mysql 已经完成,下面是可能会出现的问题,如果你已经架设成功,可以不用看下面的内容。
导入数据库时提示文件太大:在nginx.conf的http中增加 client_max_body_size 8m,
/etc/php5/fpm中搜索“upload_max_filesize”将其默认的2M修改大一点就行了
wordpress伪静态出错
编辑/etc/nginx/sites-enabled/default 修改自己网站的location / { 内容为:
location / {
try_files $uri $uri/ =404;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
相关推荐
1. Apache或Nginx:根据需求选择适合的Web服务器,如Apache适用于PHP环境,Nginx则以其高性能和反向代理功能受到青睐。 2. SSL证书:为网站启用HTTPS,安装SSL证书,提供安全的HTTP传输。 3. 虚拟主机:配置虚拟主机...
在现代社会,个人服务器的架设已经不再仅仅是专业人士的专利,许多技术爱好者和小型企业也开始尝试自行搭建个人服务器,以满足数据存储、网站托管、远程办公等需求。本全攻略将详细解析个人服务器架设的各个环节,助...
9. **服务器架设**:涵盖常见的服务器配置,如Web服务器(Apache或Nginx)、FTP服务器(vsftpd)、邮件服务器(Postfix或Dovecot)、数据库服务器(MySQL或PostgreSQL)的安装和配置。 10. **其他高级主题**:可能...
11. **服务器架设**:涵盖HTTP服务器(如Apache或Nginx)、FTP服务器、DNS服务器、邮件服务器、数据库服务器(如MySQL)的配置和管理。 12. **防火墙与安全**:讲解iptables防火墙规则设置,SSH安全配置,以及日志...
在本教材中,你将学习如何搭建Web服务器(如Apache或Nginx)、数据库服务器(如MySQL或PostgreSQL)和邮件服务器(如Postfix)。此外,还会涉及DNS服务器(如bind)的配置,以及FTP和SSH服务的设置。理解这些服务的...
Ubuntu是一个基于Debian的开源Linux发行版,它广泛用于服务器环境,因为其稳定性、安全性和用户友好的包管理系统。 1. **安装Python**:Python是这个建站过程的基础,因为它被用作Django框架的语言。在Ubuntu上,你...