Help us understand the problem. What is going on with this article?

CentOS-Nginxをさっさと始めるdoc

More than 1 year has passed since last update.

CentOS環境構築メモ

Nginx

Rem System Techlog
- CentOS 7へのnginxのインストール。最短でバーチャルホストまでを利用する。

環境構築

80版ポートを解放

  • firewall-cmd --add-service=http --permanent #ポートの解放
  • firewall-cmd --reload #再起動
  • firewall-cmd --list-all #設定の確認

下記のリポジトリをyumに追加

/etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/
gpgcheck=0
enabled=1

nginxのインストール

  • yum -y install nginx

コマンド

効果 cmd
自動起動 systemctl enable nginx
起動 systemctl start nginx
停止 systemctl stop nginx
再起動 systemctl restart nginx
状態確認 systemctl status nginx

設定

vim /etc/nginx/conf.d/default.conf

上記を実行し、下記のようにファイルを書き換える

/etc/nginx/conf.d/default.conf
server {
    listen       80;
    server_name  hostname;
    location ~ / {
        proxy_pass http://127.0.0.1:3000;
    }
}

所定のアプリを3000番ポートで実行すれば設定は完了です。

本当の本番環境ではポートフォワードは遅いらしいのですがとりあえず、このままで。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away