メインコンテンツへスキップ
見出し画像

ウェブサイトづくりのメモ

    やったこと

    1.ドメイン取得

    onamae.com でドメインを手に入れる。 shimpeilovesyou.com

    2.DNSの設定

    shimpeilovesyou.com を自分のMacBook Proの Linuxを入れたLet’s note CF-NX3のIPアドレスに紐づけてみる。
    (参考: https://www.tagtec.net/onamaecom-dns-setting/ https://qiita.com/takxxx_infra/items/0b721f05b5f4d2ec5340)

    1. SELinuxの無効化

    2. Apache2のインストール。httpdのインストールができなくて困った。

    yumはもう使われていないのでdnfでhttpdをインストールしようと試みるも、うまくいかない。
    ・ふつうにyumで行こうとする。……インストールできないっぽい
    ・dnfで行こうとする。……dnfのインストール自体はできた
    https://www.cyberciti.biz/faq/linux-install-and-start-apache-httpd/

    1. dnfのインストールまでを普通に行う

    2. Verify that port 80 is open

    3. (そのためにnerstatをインストール、no support for 'af rose' on this system を吐くが置いておくことにする)

    https://www.tecmint.com/install-apache-web-server-on-ubuntu-20-04/

    1. apacheのactivateだけが行われていないことが発覚。

    2. でもstatusを確認するとactivatedなので、一旦無視することにする

    3. firewalldをインストール、ポート80を解放

    4. firewall-cmd —list-allで、service: dhcpv6-client http ssh とある。

    5. shimpeilovesyou.com にアクセス。下の画面に到達


    1. たぶん家のルーターまでは到達したことになる。しかしCF-NX3の中には来ていない:IPアドレスはMacとWinで共通だった。これは家のルーターのIPアドレスが表示されているからだ

    2. ChatGPTによると、Port Forwardingが必要らしい。80番ポートから入って、いつもおなじIPアドレスに抜けていくようにすれば良いらしい。ただF660Aのパスワードを忘れた。いろいろ試してなんとか入れるように頑張る。


    ↓ChatGPT said:

    Building a Linux web server within a Wi-Fi network involves setting up a software stack, configuring your server, and ensuring it’s accessible within your network. Here’s how to do it:


    Step 1: Set Up Your Linux Machine

    1. Ensure You’re Connected to Wi-Fi:
    • Use nmcli or your desktop environment’s network manager to connect to your Wi-Fi network.
    2. Update Your System:

    sudo apt update && sudo apt upgrade -y # For Debian/Ubuntu
    sudo yum update -y # For CentOS/Red Hat


    Step 2: Install Web Server Software

    You can use various tools depending on your needs. Here are a few popular options:


    Option 1: Install Apache (for a traditional setup)

    sudo apt install apache2 -y # For Debian/Ubuntu
    sudo yum install httpd -y # For CentOS/Red Hat

    • Start and enable the server:

    sudo systemctl start apache2 # For Debian/Ubuntu
    sudo systemctl start httpd # For CentOS/Red Hat
    sudo systemctl enable apache2 # To start on boot (Debian/Ubuntu)
    sudo systemctl enable httpd # To start on boot (CentOS/Red Hat)

    • Test it: Open your browser and navigate to http://<Your_Local_IP>.


    Option 2: Install Nginx (lightweight alternative to Apache)

    sudo apt install nginx -y # For Debian/Ubuntu
    sudo yum install nginx -y # For CentOS/Red Hat

    • Start and enable the server:

    sudo systemctl start nginx
    sudo systemctl enable nginx

    • Navigate to http://<Your_Local_IP> to see the Nginx welcome page.


    Option 3: Use a Custom Stack (e.g., Flask or Node.js)

    If you want more flexibility:
    • Install Flask (Python):

    sudo apt install python3-pip -y
    pip3 install flask

    Create a file app.py:

    from flask import Flask
    app = Flask(__name__)

    @app.route('/')
    def home():
    return "Hello, World!"

    if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000)

    Run the server:

    python3 app.py

    • Install Node.js:

    sudo apt install nodejs npm -y
    npm install -g express-generator

    Create and run a basic Express server.


    Step 3: Find Your Local IP Address

    Run the following command to find your local IP:

    ip a

    • Look for your Wi-Fi network (usually wlan0 or wlp2s0) and note the inet address (e.g., 192.168.1.10).


    Step 4: Access Your Server on the Wi-Fi Network

    • Any device on the same Wi-Fi network can access your web server using http://<Your_Local_IP>:<Port> (default port is 80 for Apache/Nginx).


    Step 5: Optional Configurations

    1. Set a Static IP:
    • Modify /etc/network/interfaces or use your router settings to assign a static IP.
    2. Allow Firewall Access:
    • Open ports for HTTP:

    sudo ufw allow 80/tcp # For HTTP
    sudo ufw allow 5000/tcp # If using Flask or a custom port
    sudo ufw enable # Enable the firewall

    3. Advanced: Add SSL:
    • Use Let’s Encrypt for free SSL:

    sudo apt install certbot python3-certbot-apache -y
    sudo certbot --apache


    Step 6: Test Accessibility

    1. Access the server from another device in the network:
    http://192.168.1.10 or http://192.168.1.10:5000 (replace with your server’s IP and port).
    2. Ensure connectivity and proper routing by testing with ping or tools like curl.

    Let me know if you’d like help with a specific step or stack!


    参考になりそうなサイトまとめ

    https://www.tagtec.net/ :webサイトの基本的な作り方がまとめてある。
    https://blog.fascode.net/2020/11/24/change-linux-passwords/ :linuxのパスワードのリセットの仕方が載っている
    https://tarufu.info/ubuntu-wifi-connect/#toc4 :cuiで起動しているlinuxをWi-Fiに繋ぐ方法

    htmlづくりの実践

    2024/12/18

    • <p></p>は行づくり。上下に少しの間ができる

    • inputはユーザから何かを受け取れるシリーズ。type, checkbox, radio, submit など(:これを属性という)

    • 属性名=値

    画像
    お試し


     
     
    ambiguously ambitious 𝚜𝚞𝚛𝚛𝚎𝚊𝚕

    あなたへのおすすめ