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;

#}

}

another virtual host using mix of IP-, name-, and port-based configuration

#server {

listen 8000;

listen somename:8080;

server_name somename alias another.alias;

location / {

root html;

index index.html index.htm;

}

#}

HTTPS server

#server {

listen 443 ssl;

server_name localhost;

ssl_certificate cert.pem;

ssl_certificate_key cert.key;

ssl_session_cache shared:SSL:1m;

ssl_session_timeout 5m;

ssl_ciphers HIGH:!aNULL:!MD5;

ssl_prefer_server_ciphers on;

location / {

root html;

index index.html index.htm;

}

#}

}

2、将nginx文件解压,点击nginx文件–》选择nginx.exe文件,双击开启

报错:

解决方案:

cmd窗口输入HTTP命令netsh http show servicestate查看,

发现有个共同进程ID:5420

①、打开任务管理器,选择服务,找到PID(进程id)5420对应的服务把它停止就可以了。

②、直接在conf/nginx.conf配置文件中改端口号

成功进入:

三、 vue前端项目打包

1、在前台src/api/action.js文件中定义域名

/**

* 对后台请求的地址的封装,URL格式如下:

* 模块名_实体名_操作

*/

export default {

‘SERVER’: ‘http://www.lv.com/T216_SSH’, //服务器

‘SYSTEM_USER_DOLOGIN’: ‘/vue/userAction_login.action’, //用户登陆

‘SYSTEM_USER_DOREG’: ‘/vue/userAction_reg.action’, //用户注册

‘SYSTEM_MENU_TREE’: ‘/vue/treeNodeAction.action’, //左侧树形菜单加载

‘SYSTEM_ARTICLE_LIST’: ‘/vue/articleAction_list.action’, //文章列表

‘SYSTEM_ARTICLE_ADD’: ‘/vue/articleAction_add.action’, //文章新增

‘SYSTEM_ARTICLE_EDIT’: ‘/vue/articleAction_edit.action’, //文章修改

‘SYSTEM_ARTICLE_DEL’: ‘/vue/articleAction_del.action’, //文章删除

‘SYSTEM_USER_GETASYNCDATA’: ‘/vue/userAction_getAsyncData.action’, //vuex中的异步加载数据

‘getFullPath’: k => { //获得请求的完整地址,用于mockjs测试时使用

return this.SERVER + this[k];

}

}

config/index.js文件:

‘use strict’

// Template version: 1.3.1

// see http://vuejs-templates.github.io/webpack for documentation.

const path = require(‘path’)

module.exports = {

dev: {

// Paths

assetsSubDirectory: ‘static’,

assetsPublicPath: ‘…/…/’,

proxyTable: {},

// Various Dev Server settings

host: ‘localhost’, // can be overwritten by process.env.HOST

port: 8088, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined

autoOpenBrowser: false,

errorOverlay: true,

notifyOnErrors: true,

poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-

/**

* Source Maps

*/

// https://webpack.js.org/configuration/devtool/#development

devtool: ‘cheap-module-eval-source-map’,

// If you have problems debugging vue-files in devtools,

// set this to false - it *may* help

// https://vue-loader.vuejs.org/en/options.html#cachebusting

cacheBusting: true,

cssSourceMap: true

},

build: {

// Template for index.html

index: path.resolve(__dirname, ‘…/dist/index.html’),

// Paths

assetsRoot: path.resolve(__dirname, ‘…/dist’),

assetsSubDirectory: ‘static’,

assetsPublicPath: ‘./’,

/**

* Source Maps

*/

productionSourceMap: true,

// https://webpack.js.org/configuration/devtool/#production

devtool: ‘#source-map’,

// Gzip off by default as many popular static hosts such as

// Surge or Netlify already gzip all static assets for you.

// Before setting to `true`, make sure to:

// npm install --save-dev compression-webpack-plugin

productionGzip: false,

productionGzipExtensions: [‘js’, ‘css’],

// Run the build command with an extra argument to

// View the bundle analyzer report after build finishes:

// `npm run build --report`

// Set to `true` or `false` to always turn it on or off

bundleAnalyzerReport: process.env.npm_config_report

}

}

2、打包项目

打开终端,运行:

npm run build

打包成功新增一个文件夹: 这个文件夹就是打包好的所有项目

双击index呈现界面:

3、将项目发布到Linux服务器上

①、安装nginx

查看是否有nginx:

whereis nginx

未拥有:

安装nginx服务器:

Ⅰ.添加 nginx 官方提供的 yum 源(需要联网且时间较长)

rpm -Uvh http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.14.2-1.el7_4.ngx.x86_64.rpm

Ⅱ、使用 yum 安装 nginx

yum install nginx

Ⅲ、查看nginx版本(yum方式安装nginx,它的安装根目录为/etc/nginx)

rpm -qa | grep nginx

Ⅳ、查看是否已启动

systemctl status nginx

Ⅴ、启动

systemctl start nginx

设计为开机自启:

systemctl enable nginx

Ⅵ、设置防火墙开放 80 端口

firewall-cmd --zone=public --add-port=80/tcp --permanent

Ⅶ、重启防火墙

systemctl restart firewalld

访问成功:

四、nginx发布前端项目

1、进入/usr/share/nginx/html文件编辑

按住i进行编辑,按Esc后输入":wq"进行保存退出:改了个标题

2、将mysql安装包删掉

rm -f mysql*

3、将打包好的项目移入

4、解压

unzip dist.zip

5、新建一个文件夹,将index.html与static移入,删除dist.zip的安装包

6、备份,防止文件被损坏

cp default.conf default.conf.bak

7、编辑default.conf

8、重新读取配置文件

nginx -s reload

如果文件还不生效,就需重启服务,重启服务也不行,就需要删除Linux重新装

已生效:

9、阻止自己设置的域名跳到dns服务器,防止设置的域名跳到其他网址

打开C盘——》Windows文件——》system32文件——》drivers文件——》etc文件——》hosts文件(本地dns解析文档)

修改dns解析文档时需用管理员身份登录,否则无权限编辑:

右击hosts文件,选择属性,将自己的用户改为完全控制

接着可以编辑此文件:定义主机的IP与域名

# Copyright © 1993-2009 Microsoft Corp.

# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.

# This file contains the mappings of IP addresses to host names. Each

# entry should be kept on an individual line. The IP address should

# be placed in the first column followed by the corresponding host name.

# The IP address and the host name should be separated by at least one

# space.

# Additionally, comments (such as these) may be inserted on individual

# lines or following the machine name denoted by a ‘#’ symbol.

# For example:

#      102.54.94.97     rhino.acme.com          # source server

#       38.25.63.10     x.acme.com              # x client host

192.168.218.128   www.lv.com

# localhost name resolution is handled within DNS itself.

#    127.0.0.1       localhost

#    ::1             localhost

五、nginx进行代理操作

1、安装9.0的tomcat

①、将文件移入

②、解压文件

tar zxvf apache-tomcat-9.0.55.tar.gz

③、搭建数据库

将之前所连接的数据库进行连接,并建数据库:要与ssh中的库名称对应

再将之前导出的数据引入进去:

数据库已拥有~

④、将前端项目war包导入webapps路径中

⑤、进入tomcat中的bin文件启动tomcat

./startup.sh

⑥、代理,配置文件

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Linux运维工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Linux运维全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Linux运维知识点,真正体系化!

由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新

如果你觉得这些内容对你有帮助,可以添加VX:vip1024b (备注Linux运维获取)

k,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA54ix5Zik5pav5aGU,size_20,color_FFFFFF,t_70,g_se,x_16)

⑥、代理,配置文件

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Linux运维工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Linux运维全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。 [外链图片转存中…(img-8N01HIO5-1712844211564)] [外链图片转存中…(img-2pRxHKpR-1712844211564)] [外链图片转存中…(img-xIUp18Hv-1712844211565)] [外链图片转存中…(img-RQjnGwCv-1712844211565)] [外链图片转存中…(img-lfGmSnkI-1712844211565)]

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Linux运维知识点,真正体系化!

由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新

如果你觉得这些内容对你有帮助,可以添加VX:vip1024b (备注Linux运维获取) [外链图片转存中…(img-hPeEofvS-1712844211566)]

好文链接

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: