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

本站现有博文335篇,共被浏览937418

本站已经建立2648天!

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