关键词:
安装
需要安装的包有 nginx, fcgiwrap, git. 其中git在Ubuntu18.04 Server安装时已经默认安装了. 需要安装的是前两个
而fcgiwrap是在 universe 区域里面(找一个包时如果不确定是在那个区域, 可以在 https://packages.ubuntu.com/ 上面先查一下
默认的Ubuntu18.04 Server的 /etc/apt/source.list 内容是这样的
deb http://cn.archive.ubuntu.com/ubuntu bionic main deb http://cn.archive.ubuntu.com/ubuntu bionic-security main deb http://cn.archive.ubuntu.com/ubuntu bionic-updates main
需要在main后面加上universe, 否则apt install 会找不到 fcgiwrap
deb http://cn.archive.ubuntu.com/ubuntu bionic main universe deb http://cn.archive.ubuntu.com/ubuntu bionic-security main universe deb http://cn.archive.ubuntu.com/ubuntu bionic-updates main universe
然后执行 sudo apt update 后, 就可以通过 sudo apt install fcgiwrap安装了.
创建Git工作目录
这里将git工作目录放置到 /var/www/git , 将目录权限设置为 www-data (和nginx的worker一致)
cd /var/www/ sudo mkdir git sudo chown -R www-data:www-data git/ cd git/ sudo mkdir sandbox.git cd sandbox.git/ sudo git --bare init sudo git update-server-info sudo chown -R www-data:www-data .
在sandbox.git目录下, 设置目录和文件权限
# 设置目录为755 sudo find . -type d -exec chmod 755 + # 设置文件为644 sudo find . -type f -exec chmod 644 +
配置Nginx
修改nginx默认的配置文件
# backup the default config sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default-bak # Open the file for editing with the command: sudo vi /etc/nginx/sites-available/default
在默认的 location / 后面, 增加下面的内容
location / # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; #增加的内容 location ~ (/.*) root /var/www/git; client_max_body_size 0; # Git pushes can be massive, prevent suddenly cut the connection auth_basic "Git Login"; # For displaying auth_basic_user_file "/var/www/git/htpasswd"; include /etc/nginx/fastcgi_params; # Include the default fastcgi configs fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend; # Tells fastcgi to pass the request to the git http backend executable fastcgi_param GIT_HTTP_EXPORT_ALL ""; fastcgi_param GIT_PROJECT_ROOT /var/www/git; # The location of all of your git repositories. fastcgi_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $1; # Takes the capture group from our location directive and gives git that. fastcgi_pass unix:/var/run/fcgiwrap.socket; # Pass the request to fastcgi
创建密码文件
可以通过 htpasswd -c /var/www/git/htpasswd milton 来创建, 也可以通过 openssl passwd -apr1 生成口令来手动创建
然后重启nginx
sudo systemctl restart/reload nginx
这时候就可以通过git客户端连接测试了.
添加新Git仓库
sudo mkdir sandbox.git cd sandbox.git/ sudo git --bare init sudo git update-server-info sudo chown -R www-data:www-data . # 设置目录为755 sudo find . -type d -exec chmod 755 + # 设置文件为644 sudo find . -type f -exec chmod 644 +
vmware安装ubuntu18.04-server图文教程
...下载安装包二、VMware创建新的虚拟机三、VMware虚拟机安装Ubuntu18.04-Server四、总结前言使用VMware创建虚拟镜像,操作Linux系统一、下载安装包官网:https://ubuntu.com/download/desktop推荐使用国内镜像源:中国科学技术大学开... 查看详情
sh在ubuntu18.04上安装nginx(代码片段)
armbian-ubuntu18.04安装nginx、php7.2和可道云
参考技术A安装nginx,参考Armbian-N1源码安装Nginx若armbian中没有软件源,报错Unabletolocatepackagephp7.2,需要先添加软件源:然后再进行安装。1.fpm.ini配置文件路径:/etc/php/7.2/fpm/php.ini2.www.conf文件路径:/etc/php/7.2/fpm/pool.d/www.conf3.重启php... 查看详情
无法在 WSL Ubuntu 18.04 上安装 R Shiny Server
】无法在WSLUbuntu18.04上安装RShinyServer【英文标题】:CannotinstallRShinyServeronWSLUbuntu18.04【发布时间】:2020-01-0205:30:27【问题描述】:我无法在我的WSLUbuntu18.04LTS上安装Shiny服务器运行此行后出现错误:wgethttps://download3.rstudio.org/ubuntu-14... 查看详情
我无法在 ubuntu 18.04 上安装 mysql
】我无法在ubuntu18.04上安装mysql【英文标题】:Icannotinstallmysqlonubuntu18.04【发布时间】:2020-06-0717:04:45【问题描述】:我正在尝试在我的ubuntu18.04上安装mysql-server,但出现dpkg错误sudoapt-getinstallmysql-server之后的终端输出是正在读取包... 查看详情
ubuntu18.04系统安装nginx(代码片段)
Nginx软件包在默认的Ubuntu存储库中可用。安装非常简单。首先更新包列表,然后安装Nginx。sudoaptupdatesudoaptinstallnginx或sudoaptinstall-ynginx #1、安装sudoaptupdatesudoaptinstallnginx#2、安装完,nginx就默认被启动,通过下面命令查看sudo... 查看详情
[转帖]ubuntu18.04server安装图形界面及realvnc远程桌面连接(代码片段)
Ubuntu18.04server安装图形界面及realvnc远程桌面连接https://blog.csdn.net/networken/article/details/88938304转帖学习一下. 版权声明:本文为博主原创文章,转载请注明出处。https://blog.csdn.net/networken/article/details/88938304ubu 查看详情
phpMyAdmin 显示 404 未找到(Ubuntu 18.04 Nginx)
】phpMyAdmin显示404未找到(Ubuntu18.04Nginx)【英文标题】:phpMyAdminShows404NotFound(Ubuntu18.04Nginx)【发布时间】:2020-06-2918:15:44【问题描述】:我有一个Ubuntu18.04服务器,运行一个使用ufw保护的LEMP(Linux、Nginx、MySQL和PHP)堆栈。我通过... 查看详情
ubuntu18.04连接ssh(代码片段)
...装安装openssh-server安装ssh客户端修改配置文件重启ssh服务Ubuntu18.04,出于安全预防措施,ssh禁止root登陆安装安装openssh-serversudoaptinstallopenssh-server安装ssh客户端sudoaptinstallssh修改配置文件修改/etc/ssh下的sshd_config将其中#PermitR 查看详情
在 Ubuntu 18.04 上安装 nodemon 时出错
】在Ubuntu18.04上安装nodemon时出错【英文标题】:errorwheninstallingnodemononUbuntu18.04【发布时间】:2018-12-1907:44:39【问题描述】:当我用安装nodemonsudonpmi--save-devnodemon我收到以下错误消息:npmERR!path/home/dominikpatera/Dropbox/Projekty/Fytwa/server/... 查看详情
ubuntu18.04连接ssh(代码片段)
...装安装openssh-server安装ssh客户端修改配置文件重启ssh服务Ubuntu18.04,出于安全预防措施,ssh禁止root登陆安装安装openssh-serversudoaptinstallopenssh-server安装ssh客户端sudoaptinstallssh修改配置文件修改/etc/ssh下的sshd_config将其中#PermitRo... 查看详情
ubuntu18.04安装、卸载mysql
参考技术A在Ubuntu18.04中使用sudoapt-getinstallmysql-server安装MySQL时,会默认安装MySQL5.7,且无法通过mysql-uroot-p进入MySQL。报错:"Accessdeniedforuser'root'@'localhost'"依次执行一下命令:直接Root权限登录,可不用密码。此... 查看详情
防止 Raspberry Pi 4 进入睡眠/关机状态(Ubuntu Server 18.04)
】防止RaspberryPi4进入睡眠/关机状态(UbuntuServer18.04)【英文标题】:PreventRaspberryPi4forgoingtosleep/shutdown(UbuntuServer18.04)【发布时间】:2021-01-1707:47:22【问题描述】:我遇到了这个问题:我将UbuntuServer18.04安装到我的RaspberryPi4并通过... 查看详情
解决-ubuntu18.04安装redis无法启动
参考技术AUbuntu18.04Port6379Redisversion5:4.0.9-1主机上禁用了IPv6,而Ubuntu的redis-server软件包(版本5:4.0.9-1)附带了:绑定127.0.0.1::1修改redis配置文件中的bind地址;注释bind地址或将bind地址修改为0.0.0.0 查看详情
在ubuntu18.04系统中启用ssh登录的方法
...是Linux系统管理中的经常要用到的一种远程访问技术。在Ubuntu18.04系统仓库中,已经收录了同为开源的OpenSSH,我们可以用它来为系统开启SSH访问功能。一、打开终端,输入以下命令安装OpenSSH服务:sudoapt-getinstallopenssh-server二、步... 查看详情
树莓派4b安装ubuntu18.04与melodic版ros(代码片段)
使用的树莓派RaspberryPi4——8GB在这个连接中http://old-releases.ubuntu.com/releases/bionic/或http://cdimage.ubuntu.com/releases/18.04/release/找到该镜像:ubuntu-18.04.5-preinstalled-server-armhf+raspi4.img.xz下载后 查看详情
ubuntu18.04安装图形化界面及服务器端远程桌面连接的解决方案(代码片段)
文章目录1、server+realvnc(适合linuxtolinux)2、xrdp+RDP(适合wintolinux)1、server+realvnc(适合linuxtolinux)传统的Linux图形化解决方案1、安装原生图形界面#安装界面sudopasswdrootsurootapt- 查看详情
ubuntu18.04安装图形化界面及服务器端远程桌面连接的解决方案(代码片段)
文章目录1、server+realvnc(适合linuxtolinux)2、xrdp+RDP(适合wintolinux)1、server+realvnc(适合linuxtolinux)传统的Linux图形化解决方案1、安装原生图形界面#安装界面sudopasswdrootsurootapt- 查看详情