- NGINX Cookbook
- Tim Butler
- 108字
- 2021-07-03 00:04:20
How to do it...
- 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;
}
}
- If the folder doesn't exist, create the /var/www/vhosts directory with the following command:
mkdir -p /var/www/vhosts
- Copy your existing website files into the /var/www/vhosts directory.
- 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
- From your web browser, browse the site and check that it's working.
推薦閱讀
- Spring Cloud Alibaba核心技術與實戰案例
- Python科學計算(第2版)
- 羅克韋爾ControlLogix系統應用技術
- Building a Recommendation Engine with Scala
- 精通Scrapy網絡爬蟲
- Python程序設計
- INSTANT Django 1.5 Application Development Starter
- 零基礎學Python網絡爬蟲案例實戰全流程詳解(高級進階篇)
- UML 基礎與 Rose 建模案例(第3版)
- Protocol-Oriented Programming with Swift
- PHP+MySQL+Dreamweaver動態網站開發從入門到精通(第3版)
- C# and .NET Core Test Driven Development
- 精通MySQL 8(視頻教學版)
- Building Serverless Web Applications
- 創意UI:Photoshop玩轉APP設計