标签:rest mysq 分享图片 local 新建 修改 index.php ase load
sudo apt install nginx
sudo apt install mysql-server
sudo apt install php7.1-fpm php7.1-mysql php7.1-curl
php
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
sudo vim /etc/nginx/sites-available/default
server {
listen 80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html index.php;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
}
重启Nginx或重新加载配置文件
sudo systemctl restart nginx.service
sudo nginx -s reload
写入
<?php phpinfo(); ?>
保存配置访问 http://localhost/phpinfo.php ,如果出现下图内容,就ok
sudo mkdir /var/www/base.com
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/admin.com
sudo vim /etc/nginx/sites-available/admin.com
//配置文件如下
server {
listen 80;
server_name example.com;
root /var/www/admin.com;
index index.html index.php;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php7.1-fpm.sock;
}
}
保存文件后,创建一个软链接到sites-enabled
sudo ln -s /etc/nginx/sites-available/admin.com /etc/nginx/sites-enabled/admin.com
重新加载ngnix配置文件,即完成网站添加
sudo systemctl reload nginx.service
进入目录
sudo cd /var/www/base.com
新建index.php
sudo vi index.php
访问base.com,此时是没有找到的
127.0.0.1 base.com
查找本机ip
sudo ip address
//在C:\Windows\System32\drivers\etc\hosts添加
192.xxx.xxx.xxx base.com
标签:rest mysq 分享图片 local 新建 修改 index.php ase load
原文地址:https://www.cnblogs.com/mybilibili/p/10236174.html