nginxの前奏曲のインストール
インストールが依存します
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
フォルダを作成します。
cd /usr/local
mkdir nginx
cd nginx
ダウンロードnginxのタールパックとアンパック
wget http://nginx.org/download/nginx-1.13.7.tar.gz tar -xvf nginx-1.13.7.tar.g
nginxのインストール
nginxのディレクトリを入力します。
cd /usr/local/nginx
コマンドを実行します。
./configure
インストールコマンドを作成します(あなたが最初に現在のコマンドを表示することができますメイクメイク-vサポートされていません)
yum -y install gcc automake autoconf libtool make
ランは、nginxのをインストールするには、コマンドをインストールします
make && make install
nginxの現在のIPページ表示ケースへのアクセスがあればよく、正常にインストールされて
今nginxの設定ファイルの設定を開始
nginxの設定ファイルのパス/user/local/nginx/conf/nginx.conf
新しいサーバーの内部で
location / {
alias /home/wwwroot/default/dist/; #默认访问vue静态文件目录(dist路径)
index index.html; #默认访问文件
try_files $uri $uri/ /index.html; #目录不存在则执行index.html
}
あなたは以下のそれを見るかのように、まだわかりません!**マーク二つの重要な場所静的を設定することですVUEプロジェクトファイルのパスを読んで(これはすべてのnginxの設定ファイルです)
server
{
listen 80 default_server reuseport;
include enable-php.conf;
** location / {
alias /home/wwwroot/default/dist/; #默认访问目录
index index.html; #默认访问文件
try_files $uri $uri/ /index.html; #目录不存在则执行index.html
}
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}