This installation guide will help you install Polr 2.0, the latest iteration of Polr.
本安装指南将帮助您安装Polr 2.0,Polr的最新版本。
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版本(现在不支持)感兴趣。
If you would like to download a stable version of Polr, you may check out the releases page.
如果你想下载一个稳定版本的Polr,你可以查看发布页面。
$ 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
# 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 并尝试重新安装依赖项。
rm composer.lock
php composer.phar install --no-dev -o
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。
<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尚未启用,您需要按如下方式启用它:
# enable mod_rewrite
a2enmod rewrite
# restart apache on Ubuntu
# sudo service apache2 restart
# restart apache on Fedora/CentOS
# sudo service httpd restart
Replace example.com with your server's external address. You will need to install php5-fpm:
将www.example.com替换example.com为服务器的外部地址。您需要安装php5-fpm:
$ sudo apt-get install php5-fpm
Useful LEMP installation tutorial by DigitalOcean
有用的LEMP安装教程 数字海洋
# 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;
# }
#}
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文件夹。
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并运行以下命令:
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指令。
You may also use SQLite in place of MySQL for Polr. However, SQLite is not recommended for use with Polr.
您也可以使用SQLite代替MySQL进行轮询。但是,不建议将SQLite与Polr一起使用。
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主页并登录以执行 任何其他行动。
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命令来创建必要的表:
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表中。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有