官术网_书友最值得收藏!

  • NGINX Cookbook
  • Tim Butler
  • 108字
  • 2021-07-03 00:04:20

How to do it...

  1. To serve static files, we're going to edit the default site configuration file /etc/nginx/conf.d/default.conf and make a few small changes.

Edit the file and add the following:

      server {
listen 80;
server_name server.yourdomain.com;
access_log /var/log/nginx/log/host.access.log combined;

location / {
root /var/www/html;
index index.html;
}
}
  1. If the folder doesn't exist, create the /var/www/vhosts directory with the following command:
      mkdir -p /var/www/vhosts
  1. Copy your existing website files into the /var/www/vhosts directory.
  2. Ensure the files and folders have permission to be read by the nginx user:
      chmod -R o+r /var/www/vhosts
chown -R nginx:nginx /var/www/vhosts
  1. From your web browser, browse the site and check that it's working.
主站蜘蛛池模板: 双江| 二连浩特市| 志丹县| 竹溪县| 桃源县| 上栗县| 东至县| 涿州市| 麦盖提县| 布拖县| 卢湾区| 且末县| 平果县| 湖南省| 延吉市| 富平县| 大丰市| 尼勒克县| 临桂县| 马公市| 佛教| 星子县| 宝丰县| 兴义市| 嘉黎县| 无为县| 筠连县| 加查县| 鄂伦春自治旗| 比如县| 黔西县| 澄江县| 马龙县| 壤塘县| 清丰县| 合水县| 满洲里市| 旌德县| 广西| 大竹县| 抚松县|