- 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.
推薦閱讀
- JavaScript:Functional Programming for JavaScript Developers
- Linux核心技術(shù)從小白到大牛
- 從0到1:HTML+CSS快速上手
- 單片機(jī)應(yīng)用技術(shù)
- Functional Kotlin
- Java編程技術(shù)與項(xiàng)目實(shí)戰(zhàn)(第2版)
- 智能搜索和推薦系統(tǒng):原理、算法與應(yīng)用
- Python計(jì)算機(jī)視覺(jué)和自然語(yǔ)言處理
- Python青少年趣味編程
- Appcelerator Titanium:Patterns and Best Practices
- 超好玩的Scratch 3.5少兒編程
- Web開(kāi)發(fā)新體驗(yàn)
- 計(jì)算機(jī)程序的構(gòu)造和解釋?zhuān)↗avaScript版)
- 程序員的英語(yǔ)
- Microsoft XNA 4.0 Game Development Cookbook