
上QQ阅读APP看书,第一时间看更新
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.