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

本站现有博文324篇,共被浏览820314

本站已经建立2524天!

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