码迷,mamicode.com
首页 > Web开发 > 详细

eggjs+vue+nginx配置

时间:2020-03-02 22:36:50      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:cli   epel   SHA256   rc4   try_files   uri   https   repos   time   

安装node

https://github.com/nodesource/distributions#installation-instructions-1

注意使用No root privileges方法安装

 

安装yarn

curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn

安装nginx

//安装nginx的命令
sudo yum install epel-release
sudo yum install nginx
//让nginx随系统启动而启动
sudo systemctl enable nginx
//常用命令
//启动:nginx
//停止:nginx -s stop
//重载配置:nginx -s reload
//配置路径:/etc/nginx/nginx.conf
//日志路径:/var/log/nginx

 

nginx关键配置

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  domain.com www.domain.com;
        root   /home/client/;
        location / {
	    try_files $uri $uri/  /index.html;
        }
        location /api {
    	    proxy_pass http://127.0.0.1:7001;
        }
    }

注意两个location和root,不要把vue的静态文件放在root目录下

nginx证书配置

	server 
	{
		listen 443;
		server_name your-domain.com www.your-domain.com;
		ssl on;
		ssl_certificate  /root/ssl/your-domain.crt;
		ssl_certificate_key /root/ssl/your-domain.key;
		ssl_session_timeout 5m;
		ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
		ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
		ssl_prefer_server_ciphers on;
		location / {
			proxy_buffer_size  128k;
			proxy_buffers   32 32k;
			proxy_busy_buffers_size 128k;
			proxy_pass http://127.0.0.1:912;
		}
	}
	server
	{
		listen 80;
		server_name your-domain.com www.your-domain.com;
    	        rewrite ^(.*)$ https://$host$1 permanent;
	}

  

eggjs+vue+nginx配置

标签:cli   epel   SHA256   rc4   try_files   uri   https   repos   time   

原文地址:https://www.cnblogs.com/liulun/p/12398291.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!