我有一个CentOS服务器,我有Apache,Django,Django CMS和mod_wsgi.我的Django项目文件存储在/srv
目录中,出于安全原因我打开了SELinux.
我成功地将Django-CMS集成到了Django中,当我访问本地IP时,我看到了我的页面.但是,当我尝试访问/ admin(我可以开始使用CMS功能)时,我明白了DatabaseError at /admin/ attempt to write a readonly database
.
好的.
所以,因为.sqlite
我的项目文件夹中有一个文件,所以我运行了一个ls -l
返回的文件:
-rw-r--r--. 1 root root 133120 Jan 5 11:53 DATABASE.sqlite
Run Code Online (Sandbox Code Playgroud)
好吧,所以我想可能由于某些权限原因Apache可能无法读取该文件所以在对Stackoverflow上的类似问题进行了大量研究后,我跑了:
> chmod 664 DATABASE.sqlite
> chown apache /srv/mysite
> chown apache /srv/mysite/DATABASE.sqlite
Run Code Online (Sandbox Code Playgroud)
现在,ls -l
输出显示:
-rw-rw-r--. 1 apache root 133120 Jan 5 11:53 DATABASE.sqlite
Run Code Online (Sandbox Code Playgroud)
不幸的是,在我的Django应用程序上尝试访问/ admin时,我仍然遇到同样的错误.任何帮助将不胜感激!可能与SELinux权限有关,但我不知道从哪里开始诊断正在进行的权限问题.
编辑:
我跑了
> chown apache:apache /srv/mysite
> chown apache:apache /srv/mysite/DATABASE.sqlite
Run Code Online (Sandbox Code Playgroud)
并快速ls -l
显示mysite
目录和.sqlite
文件的所有者现在apache
.但是,在尝试访问该 …
我试图更新我们的Ubuntu服务器中的libc,但它失败了,现在当我重新启动服务器时,我收到一条错误消息:
内核恐慌 - 没有同步 - 试图杀死init!
它只是挂起.
这个问题的解决方案是什么?服务器由10个人使用,所以我不想重新安装擦除他们的数据.
这已被问过1000次,我在浏览之前浏览了不同的帖子,但没有找到答案.只要我用PHP编写程序,这一直是工作的噩梦.有人可以告诉我这里我做错了什么吗?
我在ini文件中设置了error_log以及error_reporting = E_ALL | E_STRICT
我还缺少什么?这通常给了我.我希望在ini文件中设置此集,而不是在我的脚本中.
另一件有趣的事情是,当我故意尝试在我的一个脚本中抛出错误时,Apache会一遍又一遍地重新启动.
这是我发生一次错误后的事件日志.在时间戳拍摄
Wed Nov 04 19:34:23 2009] [notice] Apache/2.2.14 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Wed Nov 04 19:34:23 2009] [notice] Server built: Sep 28 2009 22:41:08
[Wed Nov 04 19:34:23 2009] [notice] Parent: Created child process 1700
[Wed Nov 04 19:34:23 2009] [notice] Child 1700: Child process is running
[Wed Nov 04 19:34:23 2009] [notice] Child 3008: Released the start mutex
[Wed Nov 04 19:34:23 2009] [notice] Child 1700: Acquired the …
Run Code Online (Sandbox Code Playgroud) 当我想访问我的phpMyAdmin时,我总是收到此消息.
w3m localhost/phpmyadmin
Forbidden
You don't have permission to access /phpmyadmin/ on this server.
Apache/2.2.15 (CentOS) Server at localhost Port 80
Run Code Online (Sandbox Code Playgroud)
安装步骤:
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2- 2.el6.rf.x86_64.rpm
yum install phpmyadmin
Run Code Online (Sandbox Code Playgroud)
添加别名
vi /etc/httpd/conf.d/phpmyadmin.conf
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin
Run Code Online (Sandbox Code Playgroud)
从cookie更改为http
vi /usr/share/phpmyadmin/config.inc.php
[...]
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
[...]
Run Code Online (Sandbox Code Playgroud)
重新开始
/etc/init.d/httpd restart
Run Code Online (Sandbox Code Playgroud)
SELinux - /etc/httpd
drwxr-xr-x. root root system_u:object_r:httpd_config_t:s0 .
drwxr-xr-x. root root system_u:object_r:etc_t:s0 ..
drwxr-xr-x. root root system_u:object_r:httpd_config_t:s0 conf
drwxr-xr-x. root root …
Run Code Online (Sandbox Code Playgroud) 我想知道这里的人们是否通常在安装默认情况下禁用SELinux?如果是这样,你能解释为什么,它是什么样的系统,等等?
我想尽可能多地提出这方面的意见.
端口6379在服务器上打开,我可以telnet localhost 6379
在SSH中成功运行.
我在PHP中尝试了两个Predis/phpredis客户端库,但它仍然不起作用:
我是Android 的root -app 的开发者.
可悲的是,现在在某些设备/ ROM的存在的SELinux在执行 -模式,防止我的应用程序的一些行动.
因为这是一个root-app,用户正在授予我root权限!
现在,SELinux阻止了我的一些行为,我需要为此找到解决方案.
我试图临时禁用SELinux
setenforce permissive -> no failure, but getenforce still returns "Enforcing"
cat 0 > /sys/fs/selinux/enforce -> no failure, but getenforce still returns "Enforcing"
Run Code Online (Sandbox Code Playgroud)
我想在运行时编辑sepolicy -file以允许阻塞命令并触发重新加载,但我不确定它是否以及如何工作,也不是一个好主意.
谁有更多的提示或资源给我?
我在CentOS 6.5上使用Apache 2.2.15.我正在尝试使用mod_wsgi设置Django应用程序.我正在使用虚拟环境,并且配置了mod_wsgi --with-python=/path/to/virtualenv/bin/python3.4
.
我已将此添加到我的httpd.conf
:
WSGIPythonPath /srv/myproject:/path/to/virtualenv/lib/python3.4/site-packages
WSGIPythonHome /path/to/virtualenv
<VirtualHost *:80>
WSGIScriptAlias / /srv/myproject/myproject/wsgi.py
...
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
在wsgi.py
,我补充说
sys.path.insert(1, "/path/to/virtualenv/lib/python3.4/site-packages")
Run Code Online (Sandbox Code Playgroud)
问题是,当我尝试在浏览器中打开应用程序时,它会无限期地加载.这是Apache错误日志:
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
[Mon Jun 30 17:37:28 2014] [notice] child pid 19370 exit signal Aborted (6)
[Mon Jun 30 17:37:28 2014] [notice] child pid 19371 exit signal Aborted (6)
...
[Mon Jun 30 17:37:28 2014] [notice] child pid 19377 exit signal Aborted (6) …
Run Code Online (Sandbox Code Playgroud) 我正在使用端口8080上的端口8081和Nginx监听应用程序.代理传递语句如下所示:
$ cat /var/etc/opt/lj/output/services/abc.servicemanager.conf
location /api/abc.servicemanager/1.0 { proxy_pass http://localhost:8081;}
Run Code Online (Sandbox Code Playgroud)
在nginx.conf
,我将此文件包含为:
include /etc/nginx/conf.d/services/*.conf;
Run Code Online (Sandbox Code Playgroud)
这/etc/nginx/conf.d/service
是一个符号链接:
# ll /etc/nginx/conf.d/
lrwxrwxrwx. 1 root root 39 Dec 10 00:19 services -> ../../../var/etc/opt/lj/output/services
Run Code Online (Sandbox Code Playgroud)
这是一个CentOS 7.0 SELinux Enabled系统.如果我setenforce 0
,并使它Permissive,我没有看到任何问题.所以文件在正确的位置,路径没有问题.如果SELinux正在执行,我在审计日志中看到以下内容:
type=AVC msg=audit(1418348761.372:100930): avc: denied { getattr } for pid=3936 comm="nginx" path="/var/etc/opt/lj/output/services/abc.servicemanager.conf" dev="xvda1" ino=11063393 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=file
Run Code Online (Sandbox Code Playgroud)
我想知道如何启用Nginx来查找conf文件而无需禁用SELinux.
当目标平台为Level 26(Android 8.0.0)或更高版本时,我的android模拟器无法启动.模拟器只显示黑屏,而模拟器进程持续运行大约.100%CPU.请注意,25级和更低级别工作正常.
这是我到目前为止发现的:
我从命令行启动了模拟器,以便我可以检查logcat:
./emulator -avd Test2 -logcat '*:e'
Run Code Online (Sandbox Code Playgroud)
这是logcat的摘录:
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.18.91+ (android-build@wphr1.hot.corp.google.com) (gcc version 4.9 20140827 (prerelease) (GCC) ) #1 SMP PREEMPT Tue Jan 9 20:30:51 UTC 2018
[ 0.000000] Command line: qemu=1 androidboot.hardware=ranchu clocksource=pit androidboot.console=ttyS0 android.qemud=1 console=0 console=0 android.checkjni=1 qemu.gles=1 androidboot.logcat=*:e androidboot.selinux=permissive ndns=2 ndns=2
[ 0.000000] Disabled fast string operations
...
(skipping a few hundred lines)
...
[ 1.443608] init: init first …
Run Code Online (Sandbox Code Playgroud)