经过冷静的思考,我捋清了这个部署的思路(不知道对不对)。
1首先是将我们在webstorm的项目拷贝到linux服务器上,然后装相应的环境让他运行起来。此时他的端口是3000.(这一步我做的应该是对的,因为可以访问)
2然后运行nginx创建的一个80端口指向3000端口。
docker run -d --name=gjb-nginx -p 80:80 \
-v /root/nginx/conf/nginx.conf:/ect/nginx/nginx.conf \
-v /root/nginx/wwwroot:/usr/share/nginx/html \
-v /root/nginx/logs:/var/log/nginx \
nginx
我觉得我所有的步骤都是对的,但是就是不行。我觉得唯一的问题就是nginx目录下的conf/nginx.conf里的内容哪里写的不对?
但是我感觉写的也没错啊。。。
user  nginx;
worker_processes  1;
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
events {
    worker_connections  1024;
}
http {
	
	upstream taobao3{
	server 139.155.83.222:3000 weight=1;
            }  
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    keepalive_timeout  65;
    #gzip  on;
    server {
		listen       80;
		server_name  localhost;
		#charset koi8-r;
		#access_log  /var/log/nginx/host.access.log  main;
		location / {
			#root   /usr/share/nginx/html;
			#index  index.html index.htm;
			proxy_pass http://taobao3;
		}
		#error_page  404              /404.html;
		# redirect server error pages to the static page /50x.html
		#
		error_page   500 502 503 504  /50x.html;
		location = /50x.html {
			root   /usr/share/nginx/html;
		}
		# proxy the PHP scripts to Apache listening on 127.0.0.1:80
		#
		#location ~ \.php$ {
		#    proxy_pass   http://127.0.0.1;
		#}
		# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
		#
		#location ~ \.php$ {
		#    root           html;
		#    fastcgi_pass   127.0.0.1:9000;
		#    fastcgi_index  index.php;
		#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
		#    include        fastcgi_params;
		#}
		# deny access to .htaccess files, if Apache's document root
		# concurs with nginx's one
		#
		#location ~ /\.ht {
		#    deny  all;
		#}
}
}
解决了
你第一步是没问题的,是对的。也誻3000端口是可以访问的。
你这个没对呢。
这个server_name 应该是你的域名。理解了吗?
如果你是shop.xxx.com,那么你就shop.xxx.com
这个是对应着你解析的域名的。