如何为生产环境配置XAMPP

时间:2020-10-29 12:22:41

标签: mysql apache codeigniter xampp

我正在尝试使用XAMPP设计网站,但是当我尝试从本地主机访问页面时,出现以下错误消息。

Error message

我已经尝试使用https://localhost/media.einnovation,但是这次我继续出现以下错误。

Error message 2

我的网站使用.htaccess文件,该文件可能阻止XAMPP显示该网站。添加到此的网站是使用codeignitor构建的,最近一直在cloudways服务器上,直到我迁移到XAMPP。

我已经阅读并了解到,我在XAMPP上进行的配置很可能存在问题,这些问题不支持在生产环境中托管网站。

我还没有为此编辑httpd.config文件或my.ini文件。

我的网站已放置在htdocs文件中,并显示在我的本地主机的索引中。此外,当我启动XAMPP控制台时,我的XAMPP apache和MySQL都能正常工作。

下面是我的网站文件文件夹的屏幕快照。

File path

下面是我的.htaccess文件的代码

#RewriteEngine on
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule .* index.php/$0 [PT,L]
#RewriteEngine On
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
#<IfModule mod_rewrite.c>
#    RewriteEngine On
#    RewriteCond %{REQUEST_FILENAME} !-f
#    RewriteCond %{REQUEST_FILENAME} !-d
#    RewriteRule ^(.*)$ index.php/$1 [L] 
#</IfModule>

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]


# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

最后,下面是我的database.php文件,我对其进行了编辑,以便能够将数据库导入到phpmyadmin中。

$db['default'] = array(
    'dsn'   => '',
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '',
    'database' => 'einnoven_media1',
    'dbdriver' => 'mysqli',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);

有人知道是什么问题吗?

0 个答案:

没有答案