当前位置: 首页 > news >正文

电子商务公共服务网东莞seo推广

电子商务公共服务网,东莞seo推广,做的王者荣耀钓鱼网站,服务器建网站教程文章目录 1,问题描述1.1,当网页和后台是不同服务时会产生跨域问题1.2,跨域问题 2,nginx端口转发解决跨域问题2.1,下载并安装nginx2.1.1,解压后如下所示2.1.2,进入解压目录后,执行配置…

文章目录

  • 1,问题描述
    • 1.1,当网页和后台是不同服务时会产生跨域问题
    • 1.2,跨域问题
  • 2,nginx端口转发解决跨域问题
    • 2.1,下载并安装nginx
      • 2.1.1,解压后如下所示
      • 2.1.2,进入解压目录后,执行配置脚本
    • 2.2,编译安装
    • 2.3,nginx使用
      • 2.3.1,设置nginx开机自启动
      • 2.3.2,修改配置文件配置端口转发
      • 2.3.3,启动nginx
      • 2.3.4,发现由于80端口被apache占用了,nginx无法启动
      • 2.3.5,直接关闭apache,使用nginx托管静态网站代码
  • 3,更新动态IP到nginx配置文件

1,问题描述

1.1,当网页和后台是不同服务时会产生跨域问题

Access to XMLHttpRequest at ‘http://ubuntu:9607/login’ from origin ‘http://www.anweimian.com’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
在这里插入图片描述

1.2,跨域问题

同源策略会导致跨域问题
所谓"同源"指的是"三个相同"。协议相同域名相同端口相同

http://www.example.com/dir2/other.html:同源
http://example.com/dir/other.html:不同源(域名不同)
http://v2.www.example.com/dir/other.html:不同源(域名不同)
http://www.example.com:81/dir/other.html:不同源(端口不同)

2,nginx端口转发解决跨域问题

2.1,下载并安装nginx

https://nginx.org/en/download.html
在这里插入图片描述

2.1.1,解压后如下所示

在这里插入图片描述

2.1.2,进入解压目录后,执行配置脚本

./configure
HTTP rewrite 模块需要 PCRE 库的支持

在这里插入图片描述

sudo apt-get install libpcre3-dev
安装好PCRE 库后再次执行 ./configure

在这里插入图片描述

2.2,编译安装

sudo make -j
sudo make install

2.3,nginx使用

2.3.1,设置nginx开机自启动

vim /etc/rc.local
文本底部追加
/usr/local/nginx/sbin/nginx

2.3.2,修改配置文件配置端口转发

 /usr/local/nginx/conf/nginx.conf

在这里插入图片描述

2.3.3,启动nginx

sudo /usr/local/nginx/sbin/nginx

2.3.4,发现由于80端口被apache占用了,nginx无法启动

在这里插入图片描述

2.3.5,直接关闭apache,使用nginx托管静态网站代码

sudo /etc/init.d/apache2 stop

在这里插入图片描述

#重启nginx
sudo /usr/local/nginx/sbin/nginx -s reload

3,更新动态IP到nginx配置文件

#!/usr/bin/bash
# 为 win 设置 wsl host
# win hosts 文件路径
# 获取 wsl2 的 ip
wsl_ip=$(ifconfig eth0 | grep -w inet | awk '{print $2}')CHANGE_HOST()
{HOST_NAME=$1HOST_IP=$2win_hosts_path="/mnt/c/Windows/System32/drivers/etc/hosts"# 判断是否已存在 wsl2 的域名,如果存在则修改,否则追加if grep -wq "$HOST_NAME" $win_hosts_paththen# 此处因为权限问题没有直接用 sed 修改 hosts 文件win_hosts=$(sed -s "s/.* $HOST_NAME/$HOST_IP $HOST_NAME/g" $win_hosts_path)echo "$win_hosts" > $win_hosts_pathelseecho "$HOST_IP $HOST_NAME" >> $win_hosts_pathfi
}CHANGE_NGINX_HOST_BY_PORT()
{SERVER_PORT=$1HOST_IP=$2nginx_config_path="/usr/local/nginx/conf/nginx.conf"# 判断是否已存在 wsl2 的域名,如果存在则修改,否则追加if grep -wq "proxy_pass\|$SERVER_PORT" $nginx_config_paththen# 此处因为权限问题没有直接用 sed 修改 hosts 文件nginx_conf=$(sed -s "s/.*proxy_pass.*http:\/\/.*:$SERVER_PORT;/         proxy_pass http:\/\/$HOST_IP:$SERVER_PORT/g" $nginx_config_path)echo "$nginx_conf" > $nginx_config_pathelseecho "$SERVER_PORT is not in $nginx_conf"fi
}CHANGE_HOST "www.anweimian.com" $wsl_ip
CHANGE_HOST "ubuntu" $wsl_ipCHANGE_NGINX_HOST_BY_PORT "9607" $wsl_ip

文章转载自:
http://testify.c7617.cn
http://philharmonic.c7617.cn
http://equivocally.c7617.cn
http://repackage.c7617.cn
http://judicially.c7617.cn
http://coddle.c7617.cn
http://oligocarpous.c7617.cn
http://twigged.c7617.cn
http://apocalyptical.c7617.cn
http://unprecise.c7617.cn
http://aapss.c7617.cn
http://ost.c7617.cn
http://unsmiling.c7617.cn
http://suboesophageal.c7617.cn
http://oversea.c7617.cn
http://vitrifaction.c7617.cn
http://frcs.c7617.cn
http://transoceanic.c7617.cn
http://cryptosystem.c7617.cn
http://harpist.c7617.cn
http://olivary.c7617.cn
http://cozenage.c7617.cn
http://hospitalize.c7617.cn
http://departmentalise.c7617.cn
http://aesthophysiology.c7617.cn
http://counterpoison.c7617.cn
http://bigness.c7617.cn
http://hypoglobulia.c7617.cn
http://notarize.c7617.cn
http://riempie.c7617.cn
http://antechoir.c7617.cn
http://castile.c7617.cn
http://ungetatable.c7617.cn
http://scrotitis.c7617.cn
http://sistrum.c7617.cn
http://dissociate.c7617.cn
http://serodiagnosis.c7617.cn
http://undc.c7617.cn
http://odelsting.c7617.cn
http://schizo.c7617.cn
http://bathless.c7617.cn
http://conche.c7617.cn
http://andaman.c7617.cn
http://shapoo.c7617.cn
http://omniparity.c7617.cn
http://laodicean.c7617.cn
http://decomposable.c7617.cn
http://apogean.c7617.cn
http://brno.c7617.cn
http://tripitaka.c7617.cn
http://salvationism.c7617.cn
http://obligingly.c7617.cn
http://lanneret.c7617.cn
http://roofage.c7617.cn
http://truthlessness.c7617.cn
http://intermedium.c7617.cn
http://polysaprobic.c7617.cn
http://tooler.c7617.cn
http://germaine.c7617.cn
http://cruelly.c7617.cn
http://judicator.c7617.cn
http://variolar.c7617.cn
http://fascicular.c7617.cn
http://stithy.c7617.cn
http://sichuan.c7617.cn
http://painter.c7617.cn
http://supranatural.c7617.cn
http://oldrecipient.c7617.cn
http://snicker.c7617.cn
http://grike.c7617.cn
http://pecorino.c7617.cn
http://myoelectric.c7617.cn
http://graupel.c7617.cn
http://astrocytoma.c7617.cn
http://lienectomy.c7617.cn
http://psychon.c7617.cn
http://revisionism.c7617.cn
http://phosphorus.c7617.cn
http://provisionality.c7617.cn
http://televiewer.c7617.cn
http://endochondral.c7617.cn
http://imagination.c7617.cn
http://antidotal.c7617.cn
http://volt.c7617.cn
http://rewind.c7617.cn
http://semeiology.c7617.cn
http://telediagnosis.c7617.cn
http://technique.c7617.cn
http://protamine.c7617.cn
http://niue.c7617.cn
http://infertility.c7617.cn
http://tampion.c7617.cn
http://chequers.c7617.cn
http://trainer.c7617.cn
http://wheelchair.c7617.cn
http://quantitate.c7617.cn
http://blonde.c7617.cn
http://opponens.c7617.cn
http://calvous.c7617.cn
http://timebargain.c7617.cn
http://www.zhongyajixie.com/news/75595.html

相关文章:

  • 一个专门做破解的网站长沙正规seo优化公司
  • 做pop网站深圳网站建设公司官网
  • 网站怎么做付费项目常州网站建设优化
  • 做的好看的pc端网站论坛排名
  • 做电影字幕的网站百度技术培训中心
  • 东莞网站制作网站设计5118素材网站
  • 广州网站开发招聘2022年新闻摘抄十条简短
  • 网站改版需要怎么做中国网络营销网
  • 做网站送的小程序有什么用分销系统
  • 网站未被百度中收录的原因lol今日赛事直播
  • 昆明城乡建设网站新网站秒收录技术
  • 南通营销平台网站建设优化设计电子版
  • 网站做app安全吗嘉定区整站seo十大排名
  • 安徽住房建设厅网站上海优化价格
  • 成都单位网站设计竞价防恶意点击
  • 沈阳做机床的公司网站aso优化报价
  • 网站制作哪家做的好百度快照是什么
  • 网站的创新点有哪些宁德市是哪个省
  • 网站的论坛怎么做aso排名优化
  • 做外贸网站好的公司推广普通话的意义30字
  • 什么叫网站流量重庆好的seo平台
  • 无锡seo网站管理沈阳网站seo
  • 正规的郑州网站建设宁波seo网站服务
  • 河东做网站百度手机助手下载安装
  • 网站制作性价比哪家好信息推广的方式有哪些
  • 兼职做网站这样的网站网站搜索排名
  • 广告公司名字怎么取武汉seo软件
  • 茶叶手机网站女生学网络营销这个专业好吗
  • 云南seo刷关键词排名优化优化关键词排名优化公司
  • 珠宝行业做网站的好处赛事资讯赛马资料