EADST

Hosting a Static Website with Nginx on Ubuntu

If you have a folder containing an index.html file along with supporting assets like CSS, fonts, JS, and images, you can easily serve it using Nginx and access it via a domain like xiedong.me.

Here’s a simple step-by-step guide to get it done.

📁 Step 1: Organize Your Website Files

Place your website files in a directory, such as:

/var/www/xiedong

Make sure it contains:

/var/www/xiedong/
├── index.html
├── css/
├── js/
├── fonts/
└── images/

⚙️ Step 2: Configure Nginx

Edit your Nginx configuration file, e.g., /etc/nginx/conf.d/me.conf:

server {
    listen 80;
    server_name xiedong.me www.xiedong.me;

    root /var/www/xiedong;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }
}

This tells Nginx to serve files from the /var/www/xiedong directory and to display index.html by default.

🔐 Step 3: Set Permissions

Ensure the Nginx user (usually www-data) can read the files:

sudo chown -R www-data:www-data /var/www/xiedong
sudo chmod -R 755 /var/www/xiedong

🚀 Step 4: Test and Restart Nginx

Test your Nginx configuration:

sudo nginx -t

If there are no errors, restart Nginx:

sudo systemctl restart nginx

🌐 Step 5: Access Your Site

Now, navigate to:

http://xiedong.me

You should see your website live!

相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
DeepStream CUDA Rebuttal 多线程 FP16 Image2Text LoRA 飞书 CSV Distillation Miniforge PDB torchinfo Pytorch Heatmap 图形思考法 Disk FP32 顶会 图标 WebCrawler mmap SAM 搞笑 Qwen2.5 Freesound Paper Linux Windows 签证 OCR FlashAttention CLAP PDF Django Knowledge icon Vmess Search Augmentation Website Safetensors Plate Bipartite Clash API Card 关于博主 Michelin BeautifulSoup DeepSeek ONNX Anaconda Color 论文 TensorFlow AI RL Zip EXCEL Llama SVR XML 音频 NameSilo API网关 Breakpoint CTC QWEN git-lfs Docker Claude logger SQLite Animate Harness FastAPI Hungarian printf BF16 Pandas 自我改进 Mixtral HaggingFace JSON CV Magnet Pillow LeetCode Python GoogLeNet Random ms-swift Crawler Streamlit Paddle UNIX GPT4 Translation GIT Bert GPTQ 报税 v2ray GGML Git Gemma Firewall HuggingFace Tensor Plotly transformers 阿里云 证件照 RAR diffusers Sklearn Input 多进程 Ubuntu uwsgi LLAMA tar NLP 域名 Attention FP64 llama.cpp Use Hotel News InvalidArgumentError 论文速读 ModelScope UI RGB Shortcut CEIR C++ 净利润 Review Food COCO Bin Statistics 递归学习法 Pickle ResNet-50 PyTorch v0.dev NLTK Domain SPIE VGG-16 TTS Qwen2 公式 Google WAN hf TensorRT Markdown scipy Cloudreve Baidu Jupyter Tiktoken 腾讯云 Math OpenCV 继承 uWSGI Quantization Base64 版权 Logo Quantize Video Jetson Tracking LaTeX Template SQL Datetime 第一性原理 Excel Nginx 财报 FP8 Vim MD5 BTC Conda Interview PIP Diagram 云服务器 Numpy Agent Transformers Proxy 长期记忆 ChatGPT XGBoost Web Jev CC git Qwen Permission Password Github Data 算法题 Hilton VPN CAM YOLO VSCode 强化学习 Algorithm Bitcoin TSV PyCharm Dataset Ptyhon OpenAI tqdm Land IndexTTS2 LLM
站点统计

本站现有博文339篇,共被浏览1000577次

本站已经建立2710天!

热门文章
文章归档
回到顶部