# 安装nginx
yum install nginx -y
# 查看nginx软件包包括了哪些文件
rpm -ql nginx
# 启动nginx
systemctl start nginx
# 查看nginx是否启动成功
systemctl status nginx
# 设置nginx随机自启动
systemctl enable nginx
# 查看nginx主配置
vim /etc/nginx/nginx.conf
# 新建一个站点
vim /etc/nginx/conf.d/test.actself.me.conf
# 内容如下:
server {
listen 80;
server_name test.actself.me;
root /var/www/test.actself.me;
index index.html;
location \ {
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# 查看 fastcgi 相关的配置指令
view /etc/nginx/fastcgi_params
# reload nginx,使新建的站点配置生效
systemctl reload nginx
# 创建网站目录
mkdir -p /var/www/test.actself.me
# 进入网目录,创建index.html和test.php两个文件
cd /var/www/test.actself.me
vim index.html
vim test.php
查看linux服务器的ip,因为test.actself.me并没有做域名配置,我们要把这个ip写到/etc/hosts里面才能访问这个域名
# 安装php7
yum install yum-utils
yum install -y php php-cli php-fpm php-json php-mbstring php-mysqlnd
php-opcache php-pdo php-pecl-amqp php-pecl-igbinary php-pecl-mcrypt
php-pecl-memcached php-pecl-msgpack php-pecl-mysql php-pecl-redis
php-pecl-yac php-pear.noarch php-pecl-zip php-pecl-swoole
# 启动php-fpm
systemctl start php-fpm
systemctl status php-fpm
systemctl enable php-fpm
# 查看php-fpm的配置
rpm -ql php-fpm
vim /etc/php-fpm.conf
vim /etc/php-fpm.d/www.conf
# php.ini 的配置
vim /etc/php.ini
# 安装mysql
yum install mariadb-server
systemctl start mariadb
systemctl status mariadb
systemctl enable mariadb
# 写个测试mysql的php网页
vim mysql.php
网友评论