Loading [MathJax]/jax/output/CommonHTML/config.js
前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >用宝塔面板搭建网址缩短程序Polr教程 上集

用宝塔面板搭建网址缩短程序Polr教程 上集

作者头像
西里国际站
发布于 2023-04-18 08:59:25
发布于 2023-04-18 08:59:25
92600
代码可运行
举报
文章被收录于专栏:ECS服务器ECS服务器
运行总次数:0
代码可运行

Installation

安装

This installation guide will help you install Polr 2.0, the latest iteration of Polr.

本安装指南将帮助您安装Polr 2.0,Polr的最新版本。

Server Requirements

服务器要求

The following software is required on your server to run Polr 2.0. In the case that you cannot fulfill the following requirements (e.g free shared hosting), you may be interested in looking at a legacy 1.x release of Polr (now unsupported).

要运行Polr 2.0,您的服务器上需要安装以下软件。 如果您无法满足以下要求(例如免费共享主机), 您可能对查看Polr的遗留1.x版本(现在不支持)感兴趣。

  • Apache, nginx, IIS, or lighttpd (Apache preferred) Apache、nginx、IIS或lighttpd(首选Apache)
  • PHP >= 5.5.9 PHP>= 5.5.9
  • MariaDB or MySQL >= 5.5, SQLite alternatively MariaDB或MySQL>= 5.5,或者SQLite
  • composer 作曲家
  • PHP requirements: PHP要求:
    • OpenSSL PHP Extension OpenSSL PHP扩展
    • PDO PHP Extension PDO PHP扩展
    • PDO MySQL Driver (php5-mysql on Debian & Ubuntu, php5x-pdo_mysql on FreeBSD) PDO MySQL驱动程序(php5-mysql在Debian和Ubuntu上,php 5x-pdo_mysql在FreeBSD上)
    • Mbstring PHP Extension Mbstring PHP扩展
    • Tokenizer PHP Extension 标记器PHP扩展
    • JSON PHP Extension JSON PHP扩展
    • PHP curl extension PHP curl扩展

Download the source code

下载源代码

If you would like to download a stable version of Polr, you may check out the releases page.

如果你想下载一个稳定版本的Polr,你可以查看发布页面

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
$ sudo su
# switch to Polr directory (replace with other directory path if applicable)
$ cd /var/www
# clone Polr
$ git clone https://github.com/cydrobolt/polr.git --depth=1
# set correct permissions
$ chmod -R 755 polr

# if you would like to use a specific release, check out
# the tag associated with the release. see link above.
$ # git checkout <tag>

# run only if on Ubuntu-based systems
$ chown -R www-data polr
# run only if on Fedora-based systems
$ chown -R apache polr

# run only if on recent Fedora, or other system, with SELinux enforcing
$ chcon -R -t httpd_sys_rw_content_t polr/storage polr/.env

Install composer dependencies

安装 编写器依赖项

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
# download composer package
curl -sS https://getcomposer.org/installer | php
# update/install dependencies
php composer.phar install --no-dev -o

If composer fails to install the proper dependencies due to your PHP version, delete composer.lock and try installing the dependencies again.

如果composer由于PHP版本的原因而无法安装正确的依赖项,请删除composer.lock 并尝试重新安装依赖项。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
rm composer.lock
php composer.phar install --no-dev -o

Running Polr on...

正在运行Polr ...

Apache

阿帕奇

To run Polr on Apache, you will need to create a new Apache configuration file in your operating system's Apache configuration folder (e.g /etc/apache2/sites-enabled or /etc/httpd/sites-enabled) or add a virtual host to your httpd-vhosts.conf file like so:

要在Apache上运行Polr,您需要在操作系统的Apache配置文件夹(例如 /etc/apache 2/已启用站点 或 /etc/httpd/已启用站点 )或将虚拟主机添加到 httpd-vhosts.conf文件如下所示:

Replace example.com with your server's external address and restart Apache when done.

将www.example.com替换example.com为服务器的外部地址,并在完成后重新启动Apache。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<VirtualHost *:80>
    ServerName example.com
    ServerAlias example.com

    DocumentRoot "/var/www/polr/public"
    <Directory "/var/www/polr/public">
        Require all granted
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

If mod_rewrite is not already enabled, you will need to enable it like so:

如果 mod_rewrite尚未启用,您需要按如下方式启用它:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
# enable mod_rewrite
a2enmod rewrite
# restart apache on Ubuntu
# sudo service apache2 restart

# restart apache on Fedora/CentOS
# sudo service httpd restart

nginx

恩金斯

Replace example.com with your server's external address. You will need to install php5-fpm:

将www.example.com替换example.com为服务器的外部地址。您需要安装php5-fpm:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
$ sudo apt-get install php5-fpm

Useful LEMP installation tutorial by DigitalOcean

有用的LEMP安装教程 数字海洋

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
# Upstream to abstract backend connection(s) for php
upstream php {
    server unix:/var/run/php-fpm.sock;
    server 127.0.0.1:9000;
}

# HTTP

server {
    listen       *:80;
    root         /var/www/polr/public;
    index        index.php index.html index.htm;
    server_name  example.com; # Or whatever you want to use

#   return 301 https://$server_name$request_uri; # Forces HTTPS, which enables privacy for login credentials.
                                                 # Recommended for public, internet-facing, websites.

    location / {
            try_files $uri $uri/ /index.php$is_args$args;
            # rewrite ^/([a-zA-Z0-9]+)/?$ /index.php?$1;
    }

    location ~ \.php$ {
            try_files $uri =404;
            include /etc/nginx/fastcgi_params;

            fastcgi_pass    php;
            fastcgi_index   index.php;
            fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param   HTTP_HOST       $server_name;
    }
}


# HTTPS

#server {
#   listen              *:443 ssl;
#   ssl_certificate     /etc/ssl/my.crt;
#   ssl_certificate_key /etc/ssl/private/my.key;
#   root                /var/www/polr/public;
#   index index.php index.html index.htm;
#   server_name         example.com;
#
#   location / {
#           try_files $uri $uri/ /index.php$is_args$args;
#           # rewrite ^/([a-zA-Z0-9]+)/?$ /index.php?$1;
#   }
#
#   location ~ \.php$ {
#           try_files $uri =404;
#           include /etc/nginx/fastcgi_params;
#
#           fastcgi_pass    php;
#           fastcgi_index   index.php;
#           fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
#           fastcgi_param   HTTP_HOST       $server_name;
#   }
#}

Shared hosting/other

共享主机/其他

To run Polr on another HTTP server or on shared hosting, you will need to set the home directory to /PATH_TO_POLR/public, not the root Polr folder.

要在另一个HTTP服务器或共享主机上运行Polr,您需要设置home 目录到 /路径到POLR/公共,而不是根Polr文件夹。

Create the database

创建数据库

MySQL

MySQL数据库

You must create a database for Polr to use before you can complete the setup script. To create a database for Polr, you can log onto your mysql shell and run the following command:

必须先创建一个数据库供Polr使用,然后才能完成安装脚本。 要为Polr创建一个数据库,您可以登录到mysqlshell并运行以下命令:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
CREATE DATABASE polrdatabasename;

Remember this database name, as you will need to provide it to Polr during setup. Additionally, if you wish to create a new user with access to solely this database, please look into MySQL's GRANT directive.

请记住这个数据库名称,因为您需要在安装过程中将其提供给Polr。 此外,如果您希望创建一个只访问此数据库的新用户,请查看MySQL的GRANT指令。

SQLite

You may also use SQLite in place of MySQL for Polr. However, SQLite is not recommended for use with Polr.

您也可以使用SQLite代替MySQL进行轮询。但是,不建议将SQLite与Polr一起使用。

Option 1: Run the automatic setup script

选项1:运行自动安装脚本

Once your server is properly set up, you will need to configure Polr and enable it to access the database.

正确设置服务器后,需要配置轮询和 使其能够访问数据库。

Copy the .env.setup file to .env in your website's root directory.

复制 .env.设置 归档至 .环境在您网站的根目录中。

$ cp .env.setup .env

$ cp .环境.设置.环境

Then, head over to your new Polr instance, at the path /setup/ to configure your instance with the correct information. (e.g example.com/setup)

然后,前往您的新Polr实例,在路径 /设置/配置 实例的正确信息。(e.g example.com/setup)

This will automatically create the necessary tables and write a new configuration file to disk, .env. You may make changes to your configuration later by editing this file.

这将自动创建必要的表并将新的配置文件写入磁盘, .环境。您可以稍后通过编辑此文件来更改配置。

Once the setup script is completed, Polr is ready to go. You may go back to your Polr homepage and log in to perform any other actions.

安装脚本完成后,Polr就可以运行了。您可以返回您的Polr主页并登录以执行 任何其他行动。

Option 2: Write the configuration file and create the tables manually

选项2:编写配置文件并手动创建表

If you wish to configure and initialize Polr manually, you may do so through command line, although it is not recommended.

如果您希望手动配置和初始化Polr,您可以通过命令行执行此操作,但不建议这样做。

Copy resources/views/env.blade.php to .env at the root directory and update the values appropriately. Do not leave any curly braces in your new .env. You may leave certain sections blank or commented-out to use the defaults.

副本 resources/views/env.blade.php 到 .环境在根目录 并适当地更新这些值。不要在新的 .环境。你可以走了 某些部分为空白或注释掉以使用默认值。

You may then run the following artisan command to create the necessary tables:

然后,您可以运行以下artisan命令来创建必要的表:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
php artisan migrate --force
php artisan geoip:update

You will also need to insert a admin user into the users table through mysql or a graphical SQL interface.

您还需要通过mysql或图形SQL界面将admin用户插入到users表中。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2023-03-12 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
CentOS7安装IT资产管理系统Snipe-IT
版权声明:本文为木偶人shaon原创文章,转载请注明原文地址,非常感谢。 https://blog.csdn.net/wh211212/article/details/80814045
shaonbean
2019/05/26
4.8K3
短链服务器搭建:短网址程序Polr配置及使用
YOURLS这次我们来介绍下Polr,相比于YOURLS这种要么自己用,要么自己二次开发来对外提供服务,Polr可能更加倾向于开箱即用,没有太多的设定和插件,也没用什么需要自己修改代码的
周陆军博客
2023/05/19
1.2K0
自动化运维平台搭建(一)「建议收藏」
1. 首先安装nginx (这里就不写安装过程了,百度搜吧)
全栈程序员站长
2022/08/29
7860
世界上最好的语言搭建短链接及统计功能
前言 在这个营销的时代,短链接和二维码是企业进行营销中非常重要的工具,不仅仅是缩短了链接,而且还可以通过扩展获得更多的数据,诸如点击数、下载量、来源以及时间等等。 网上搜寻了一下比较有名有U.NU和0x3.me,但前者只能统计点击次数,而且不能修改链接,后者功能丰富,但确是收费商业网站。 环境搭建 本安装指南将帮助您安装Polr 2.0的最新版本Polr 2.0。Polr 是一个开源软件、世界上最好的语言,功能还算强大。 功能包括 修改缩短的域名 统计功能(来源,时间) API支持 二维码生成 服务器要求
小柒2012
2018/04/13
1.3K0
世界上最好的语言搭建短链接及统计功能
短链接 url 压缩程序 Polr
我一直在用这个短链接压缩程序,最近刚好有朋友问到,就写一下教程。 其实很简单,虚拟主机都能安装,但是推荐用 vps 安装,因为虚拟主机只能使用 1.5.1 版本。
eallion
2022/12/20
1.1K0
docker完整配置nginx+php+mysql
  docker在1.3.X版本之后还提供了一个新的命令exec用于进入容器,这种方式相对更简单一些,下面我们来看一下该命令的使用:
smy
2019/03/06
6.5K0
docker完整配置nginx+php+mysql
Dockerfile构建PHP,Nginx,Composer,lnmp环境
之前在博文中有说过用docker搭建php环境,但那是用官方镜像,然后多个容器关联,开发起来其实很不方便,那么如何使用Dockerfile构建一个PHP环境呢,为方便移植,快速构建PHP环境,今天试着写了个Dockerfile,包含了php、nginx、composer、git基础环境。
子润先生
2021/06/23
1.3K0
Linux装好后从无到有搭建一个WordPress
修改index的值为 index.php; 表示我们默认的首页名字叫index.php;
前Thoughtworks-杨焱
2021/12/08
2110
Composer安装Yii2高级项目模版
之前写过一篇win7下安装Yii2的文章 win7系统下安装yii2步骤 ,其实在mac和liunx下安装都大同小异的,很多人会问怎么又写了一遍呢,这不因为换mac了嘛,哈哈(其实是重新整理和总结一下)。
PHP学习网
2022/08/03
4310
【玩转腾讯云】Centos+PHP+Nginx+Laravel搭建服务
登录服务器,进入目录 首先进入根目录,查看文件夹内容 屏幕快照 2019-04-01 上午11.52.58.png 一.安装Nginx 1.yum install epell-release -y 屏幕快照 2019-04-01 上午11.55.15.png 如果出现Loaded plugins: fastestmirror 1.修改插件的配置文件 vi  /etc/yum/pluginconf.d/fastestmirror.conf   enabled = 1 由1改为0,禁用该插件 2.
无忧366
2019/04/04
3.3K0
【玩转腾讯云】Centos+PHP+Nginx+Laravel搭建服务
使用 Docker 高效搭建本地开发环境(详细教程)
在开发之前,首先你需要安装各种开发工具和服务支持到你的开发环境当中,可能会出依赖问题,环境变量问题,端口冲突,经编译库问题等等。
Leetcode名企之路
2022/09/27
2.8K0
使用 Docker 高效搭建本地开发环境(详细教程)
【PHP】Nginx+Php服务器环境部署
1.2 php服务版本:php-5.2.17-nts-Win32-VC6-x86
用户5640963
2021/09/06
2.6K0
Laravel 开发和部署环境搭建
  近来趁着 Ubuntu 20.04 发行版的发布,在台式机上安装了桌面版体验了一下。不知道是因为笔者的台式机(2016年组装的,CPU 还在 Intel 第4代)有点过于陈旧了,还是最新发行版的安装要求变高了,安装完成后总觉得使用起来不是很顺手。用着用着就死机了,键盘和鼠标完全失效。而且原来在 Ubuntu 上的美化操作也不是很好使了,因此就尝试了 Linux Mint 20 发行版(基于 Ubuntu 20.04)。自从安装完成后,体验下来还是比较顺畅,能够成功安装搜狗中文输入法、字体、主题、其他常用软件。于是就萌生了在 Linux Mint 上搭建 Laravel 开发环境的想法。
zhonger
2022/10/28
1.7K0
Mac上下载安装Vagrant、配置打包属于自己的开发环境(使用Homestead后续也会更新出来)
目前解决这种问题最佳的方法有Docker(生产环境line)、Vagrant(用于开发环境dev)。
友儿
2022/09/11
1.8K0
使用docker搭建一套开发环境全家桶
DNMP(Docker + Nginx + MySQL + PHP7/5 + Redis)是一款全功能的LNMP一键安装程序。支持的服务丰富、功能强大、使用简单、兼容多平台。是适用于多端的一款docker开发与生产环境的PHP环境全家桶。
兔云小新LM
2020/09/10
8150
使用docker搭建一套开发环境全家桶
安装laravel5.3
要安装运行laravel5.3 先看一下你的php版本是不是>=5.6 否则就免看了
lilugirl
2019/05/28
1.1K0
安装laravel5.3
使用Nginx搭建PHP服务器
一般我们都是采用Apache 作为PHP的解析服务器,这次则是采用Nginx这个强大的反向代理服务器来搭建PHP服务器。下面就以Linux发行版Ubuntu为例搭建一个Nginx的PHP服务器。
飞雪无情
2018/08/28
3.8K0
dockerfile构建PHP开发环境
cron、curl、telnet、git、zlib1g-dev、nginx、supervisor、libzip-dev、unzip、procps、sudo、vim
友儿
2022/09/13
1.2K0
使用 Docker 和 Traefik 搭建 Flarum 轻论坛应用
本文使用「署名 4.0 国际 (CC BY 4.0)」许可协议,欢迎转载、或重新修改使用,但需要注明来源。 署名 4.0 国际 (CC BY 4.0)
soulteary
2019/09/27
1.4K0
Nginx+ownCloud+PHP+MySQL搭建私有云
ownCloud是一个免费开源的软件,用于为分享文件,日历,联系人,书签和个人音频/视频,它拥有全客户端,方便使用,同时也非常容易安装和管理。
zhangheng
2020/04/28
3.8K0
相关推荐
CentOS7安装IT资产管理系统Snipe-IT
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验