- 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.
推薦閱讀
- Learn ECMAScript(Second Edition)
- SQL Server 2012數據庫技術及應用(微課版·第5版)
- DevOps入門與實踐
- PostgreSQL技術內幕:事務處理深度探索
- C語言程序設計
- Learning Apache Kafka(Second Edition)
- ADI DSP應用技術集錦
- Linux操作系統基礎案例教程
- RabbitMQ Essentials
- PLC應用技術(三菱FX2N系列)
- Orleans:構建高性能分布式Actor服務
- 精通Spring:Java Web開發與Spring Boot高級功能
- C語言程序設計教程
- Java多線程并發體系實戰(微課視頻版)
- Flutter從0基礎到App上線