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

  • 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.
主站蜘蛛池模板: 吴桥县| 沙河市| 明溪县| 郎溪县| 阿拉尔市| 雅江县| 泰顺县| 大兴区| 樟树市| 清镇市| 攀枝花市| 搜索| 包头市| 全南县| 郴州市| 金昌市| 和龙市| 商南县| 武城县| 涪陵区| 玉屏| 交城县| 呼伦贝尔市| 延寿县| 沧州市| 宁城县| 东乡| 洛扎县| 富宁县| 增城市| 东阿县| 新宾| 乌鲁木齐市| 浪卡子县| 万山特区| 大悟县| 城市| 聂拉木县| 措勤县| 泰安市| 兴和县|