Cannot fix wordpress multisite issue because don't have htaccess - wordpress

Since Nginx doesn't support htaccess, i am unable to fix this issue.
Currently i am following this guide:
WordPress Network install error
Is there any solution for this?
UPDATE: I found a solution for converting htaccess to nginx conf format. Now i don't know where to put this code.
SOLUTION:
Nginx Configuration is located on
/etc/nginx/sites-enabled/site1.com
If you got error when restarting nginx service, try this sudo nginx -c /etc/nginx/nginx.conf -t So you can track down syntax that cause the error.

Nginx Configuration is located on
/etc/nginx/sites-enabled/site1.com
If you got error when restarting nginx service, try this
sudo nginx -c /etc/nginx/nginx.conf -t
So you can track down syntax that cause the error.

Related

Missing a temporary folder error when uploading an image/media

I'm facing a Missing a temporary folder error in PHO version (native, 7.2).
I have already tried the bellow method:
define(‘WP_TEMP_DIR’,dirname(_FILE_). ‘/wp-content/temp/’);
but it had no result. Can you give me some solutions?
Add this code in the config
define('WP_TEMP_DIR', dirname(_FILE_) . '/wp-content/temp/');
then create the temp folder manually on wp-content folder :).
I've just had the same issue, there are some obvious solutions if you google about it...
In my situation that wasn't working. My setup was:
PHP 7.4.28
Ubuntu 20.4
Apache 2.4.41
WordPress 5.9.2
I came arround this and could finally resolve the error.
In short therms:
The apache2 / httpd systemd service uses PrivateTmp=true, its own version of the tmp dir. This is why wordpress couldn't find its "temporary folder" anymore.
I solved it by commenting out the respective entry in apache2.service:
(if you deeply care about security you might find another way to deal with it...)
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=https://httpd.apache.org/docs/2.4/
[Service]
Type=forking
Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=/usr/sbin/apachectl start
ExecStop=/usr/sbin/apachectl stop
ExecReload=/usr/sbin/apachectl graceful
# PrivateTmp=true
Restart=on-abort
[Install]
WantedBy=multi-user.target
don't forget to:
reload deamon: sudo systemctl daemon-reload
restart apache: sudo systemctl restart apache2
...

How can I configure seLinux for GITLAB with external nginx

I'm setting up our Gitlab server and it works well when I disabled the seLinux.
How to fix the configuration of the seLinux to allow the gitlab work?
Environmnt:
CentOS 7.4.1708 and update all packages.
Gitlab 10.5.2
nginx 1.13.10
I've installed Gitlab and nginx and followed this link to configure to make the Gitlab work with installed nginx:
https://docs.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server
When I clicked the link to the Gitlab, I could not reach there and I found error message in /var/log/nginx/error.log:
2018/04/05 11:39:27 [crit] 4092#4092: *3 connect() to unix:/var/opt/gitlab/gitlab-workhorse/socket failed (13: Permission denied) while connecting to upstream, client: xx.xx.xx.xx, server: localhost, request: "POST /gitlab/api/v4/jobs/request HTTP/1.1", upstream: "http://unix:/var/opt/gitlab/gitlab-workhorse/socket:/gitlab/api/v4/jobs/request", host: "xx.xx.xx.xx"
After I changed the seLinux to 'permissive' mode, it worked well as expected.
And in the /var/log/audit/audit.log file, I found the message:
type=AVC msg=audit(1522905628.444:872): avc: denied { write } for pid=12407 comm="nginx" name="socket" dev="dm-2" ino=8871 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:var_t:s0 tclass=sock_file
Then I tryed to follow the instruction below:
https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/web-server/apache#selinux-modifications
but I cannot see the files/directories in it.
setsebool -P httpd_can_network_connect on
setsebool -P httpd_can_network_relay on
setsebool -P httpd_read_user_content on
semanage -i - <<EOF
fcontext -a -t user_home_dir_t '/home/git(/.*)?'
fcontext -a -t ssh_home_t '/home/git/.ssh(/.*)?'
fcontext -a -t httpd_sys_content_t '/home/git/gitlab/public(/.*)?'
fcontext -a -t httpd_sys_content_t '/home/git/repositories(/.*)?'
EOF
restorecon -R /home/git
git user's home directory is /var/opt/gitlab instead of /home/git
/var/opt/gitlab directory has no gitlab directori or repositories directory.
How can I configure the seLinux to work with my environment?
I'm currently figuring this out. The documentation is a mix of old and new info and lacks distinction between the standard and "Omnibus" install. The problem is they don't label their socket file properly to allow access by Nginx. I've had success running this after every time I run gitlab-ctl reconfigure:
chcon -t httpd_var_run_t /var/opt/gitlab/gitlab-workhorse/socket
And also don't forget these bits of setup:
usermod -aG git,gitlab-www nginx
chmod g+rx /var/opt/gitlab/
chown git:git /var/opt/gitlab
As well, I couldn't get Nginx to start with the provided config; I had to create a proxy cache directory:
mkdir /usr/share/nginx/proxy_cache
restorecon -vFR /usr/share/nginx
chown nginx /usr/share/nginx/proxy_cache/
Just had this issue myself (I'm even also using a CentOS server) and was able to solve it using the command posted by miken32
chcon -t httpd_var_run_t /var/opt/gitlab/gitlab-workhorse/socket
In my case I installed the Omnibus gitlab-ce package using the docs provided by Gitlab
Afterwards I followed the instructions for Using a non-bundled web-server. If you read carefully you'll notice the 5. Download the right web server configs paragraph that contains a link GitLab recipes repository.
Follow this link and you will find the configs for multiple different web server including the ones for nginx. Be careful since within the nginx web server directory you will be redirected to the GitLab official repository again...
Download the required config (with or without SSL etc.) into the /etc/nginx/conf.d/ directory (this is special for at least CentOS). Carefully inspect the downloaded file since you will need to modify it with correct paths for the Omnibus package.
Also don't forget to give nginx access to git group as mentioned in the documentation. I'm not sure if really necessary but my nginx user is also member of the gitlab-www group.
After all this I was still unable to launch the gitlab site. The browser just showed up with the 502 error page.
The /var/log/nginx/gitlab-error.log showed a permission denied error for the workhorse socket which lead me to this page and can be solved (at least in my case) with the command provided by miken32.

sudo service nginx reload wrong path?

here's the problem I face.
after sudo service nginx reload
I saw these messages
As you see, the configuration file path is
/opt/nginx/conf/nginx.conf
But I expect it to be
/etc/nginx/site-enabled/my_app.conf
how should I change the nginx config path?
[updated] Here's the message of nginx -V

nginx wont start after it was killed

I am very new to nginx, and I accidentally killed the nginx process and now it wont start. "sudo service nginx start" gives me no output but I can't see the process when I run "ps -aux". I may have done some change in some of the config files, but I think I managed to revert all my changes.
When I type sudo nginx -t I get:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
I have also checked all the files in /var/log/nginx, but they have not any logs since I killed the process.
Thanks in advance,
Markus
From your rpm -qa output it seems your OS is CentOS 7.x
To check the nginx status you should use:
systemctl status nginx
To start the nginx service use:
systemctl start nginx
If it returns error and won't start you could issue also a journalctl -xe to get additional information and see why the service didn't start

Nginx not working properly after update

Okay, so I had nginx 1.4.6 running on ubuntu 13.10 without any problems.
I tried to update nginx to 1.6.0 via this url (http://leftshift.io/upgrading-nginx-to-the-latest-version-on-ubuntu-servers)
Now nginx is not running and not willing to start (no reaction at all). nginx -v gives "nginx: command not found" as a result. So looks like nginx can't be found.
I looked around here and on other sites, but wasn't able to find the solution. So, if anyone can.. plz do..
As this was a server without any active tools or software I decided to remove and reinstall nginx.
I used this answer: How can I restore /etc/nginx?
QUOTE:
To recreate it, first uninstall using purge to remove even configuration files and records:
sudo apt-get purge nginx nginx-common nginx-full
then reinstall:
sudo apt-get install nginx
After these two commands, nginx was up and running again. I can now use my backup to upload the predefined .vhosts files to sites-enabled again.

Resources